Download roberta.py from Jinwchoi06/bert-ensemble: direct link, hf CLI and curl.
- Browser
- Download file 397 Bytes
-
https://huggingface.co/Jinwchoi06/bert-ensemble/resolve/main/roberta.py
- Command line
-
hf download hf://Jinwchoi06/bert-ensemble/roberta.py
-
curl -L -o roberta.py https://huggingface.co/Jinwchoi06/bert-ensemble/resolve/main/roberta.py
397 Bytes
| from transformers import pipeline | |
| # roberta tasks | |
| # fill-mask | |
| # feature extraction | |
| # have to use more specific models/other models for other tasks | |
| # for mask gen | |
| unmasker = pipeline('fill-mask', model='roberta-base', device=0) | |
| results = unmasker("Obama is <mask>.", top_k=10) | |
| for prediction in results: | |
| print(f"Score: {prediction['score']:.4f} | Prediction: {prediction['sequence']}") |