Commit ·
3bdc77c
1
Parent(s): ecad111
Update README.md
Browse files
README.md
CHANGED
|
@@ -2,17 +2,17 @@
|
|
| 2 |
license: mit
|
| 3 |
---
|
| 4 |
|
| 5 |
-
Example:
|
| 6 |
|
| 7 |
```python
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
'''
|
|
|
|
| 2 |
license: mit
|
| 3 |
---
|
| 4 |
|
| 5 |
+
Example classification:
|
| 6 |
|
| 7 |
```python
|
| 8 |
+
import torch
|
| 9 |
+
import tensorflow as tf
|
| 10 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 11 |
+
tokenizer = AutoTokenizer.from_pretrained("cardiffnlp/twitter-roberta-base-sentiment")
|
| 12 |
+
model = AutoModelForSequenceClassification.from_pretrained("paragon-analytics/bert_resil")
|
| 13 |
|
| 14 |
+
encoded_input = tokenizer("We will survive this.", return_tensors='pt')
|
| 15 |
+
output = model(**encoded_input)
|
| 16 |
+
scores = output[0][0].detach().numpy()
|
| 17 |
+
scores = tf.nn.softmax(scores)
|
| 18 |
'''
|