Instructions to use cardiffnlp/twitter-roberta-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cardiffnlp/twitter-roberta-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="cardiffnlp/twitter-roberta-base")# Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("cardiffnlp/twitter-roberta-base") model = AutoModelForMaskedLM.from_pretrained("cardiffnlp/twitter-roberta-base", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
Commit ·
73c9ee0
1
Parent(s): 1b419e5
Update README.md
Browse files
README.md
CHANGED
|
@@ -2,14 +2,13 @@
|
|
| 2 |
|
| 3 |
This is a roBERTa-base model trained on ~58M tweets, described and evaluated in the [_TweetEval_ benchmark (Findings of EMNLP 2020)](https://arxiv.org/pdf/2010.12421.pdf). To evaluate this and other LMs on Twitter-specific data, please refer to the [Tweeteval official repository](https://github.com/cardiffnlp/tweeteval).
|
| 4 |
|
| 5 |
-
|
| 6 |
## Example Masked Language Model
|
| 7 |
|
| 8 |
```python
|
| 9 |
from transformers import pipeline, AutoTokenizer
|
| 10 |
import numpy as np
|
| 11 |
|
| 12 |
-
MODEL = "cardiffnlp/roberta-base
|
| 13 |
fill_mask = pipeline("fill-mask", model=MODEL, tokenizer=MODEL)
|
| 14 |
tokenizer = AutoTokenizer.from_pretrained(MODEL)
|
| 15 |
|
|
@@ -29,6 +28,8 @@ for text in texts:
|
|
| 29 |
print_candidates()
|
| 30 |
```
|
| 31 |
|
|
|
|
|
|
|
| 32 |
```
|
| 33 |
------------------------------
|
| 34 |
I am so <mask> 😊
|
|
@@ -44,4 +45,7 @@ I am so <mask> 😢
|
|
| 44 |
3) tired 0.138
|
| 45 |
4) sick 0.0278
|
| 46 |
5) hungry 0.0232
|
| 47 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
This is a roBERTa-base model trained on ~58M tweets, described and evaluated in the [_TweetEval_ benchmark (Findings of EMNLP 2020)](https://arxiv.org/pdf/2010.12421.pdf). To evaluate this and other LMs on Twitter-specific data, please refer to the [Tweeteval official repository](https://github.com/cardiffnlp/tweeteval).
|
| 4 |
|
|
|
|
| 5 |
## Example Masked Language Model
|
| 6 |
|
| 7 |
```python
|
| 8 |
from transformers import pipeline, AutoTokenizer
|
| 9 |
import numpy as np
|
| 10 |
|
| 11 |
+
MODEL = "cardiffnlp/twitter-roberta-base"
|
| 12 |
fill_mask = pipeline("fill-mask", model=MODEL, tokenizer=MODEL)
|
| 13 |
tokenizer = AutoTokenizer.from_pretrained(MODEL)
|
| 14 |
|
|
|
|
| 28 |
print_candidates()
|
| 29 |
```
|
| 30 |
|
| 31 |
+
Output:
|
| 32 |
+
|
| 33 |
```
|
| 34 |
------------------------------
|
| 35 |
I am so <mask> 😊
|
|
|
|
| 45 |
3) tired 0.138
|
| 46 |
4) sick 0.0278
|
| 47 |
5) hungry 0.0232
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
## Example Feature Extraction
|
| 51 |
+
TODO
|