File tree Expand file tree Collapse file tree 5 files changed +31
-0
lines changed Expand file tree Collapse file tree 5 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1414
1515- [ Iris classification] ( pytorch/iris-classifier ) : deploy a model to classify iris flowers.
1616
17+ - [ Search completion] ( pytorch/search-completer ) : deploy a model to complete search terms.
18+
1719- [ Text generation with DistilGPT2] ( pytorch/text-generator ) : deploy Hugging Face's DistilGPT2 model to generate text.
1820
1921- [ Answer generation with DialoGPT] ( pytorch/answer-generator ) : deploy Microsoft's DialoGPT model to answer questions.
Original file line number Diff line number Diff line change 1+ - kind : deployment
2+ name : search
3+
4+ - kind : api
5+ name : completer
6+ predictor :
7+ path : predictor.py
8+ compute :
9+ cpu : 1
10+ gpu : 1
11+ mem : 4G
Original file line number Diff line number Diff line change 1+ import torch
2+ import regex
3+ import tqdm
4+
5+ roberta = torch .hub .load ("pytorch/fairseq" , "roberta.large" )
6+ roberta .eval ()
7+ roberta .cuda ()
8+
9+
10+ def predict (sample , metadata ):
11+ predictions = roberta .fill_mask (sample ["text" ] + " <mask>" , topk = 5 )
12+ return [prediction [0 ] for prediction in predictions ]
Original file line number Diff line number Diff line change 1+ torch
2+ regex
3+ tqdm
Original file line number Diff line number Diff line change 1+ {
2+ "text" : " machine learning is"
3+ }
You can’t perform that action at this time.
0 commit comments