Update README.md
Browse files
README.md
CHANGED
|
@@ -86,4 +86,23 @@ learning_rate = 3e-5
|
|
| 86 |
<td align="center">92.12%</td>
|
| 87 |
</tr>
|
| 88 |
</tbody>
|
| 89 |
-
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
<td align="center">92.12%</td>
|
| 87 |
</tr>
|
| 88 |
</tbody>
|
| 89 |
+
</table>
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
## Use in Transformers
|
| 93 |
+
```python
|
| 94 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline
|
| 95 |
+
model_name = "NoWayBack/batteryscibert-uncased-abstract-mtc"
|
| 96 |
+
|
| 97 |
+
# Get predictions
|
| 98 |
+
nlp = pipeline('text-classification', model=model_name, tokenizer=model_name, top_k=5)
|
| 99 |
+
input_string = "Sodium-ion batteries are among the most promising alternatives to lithium-based " \
|
| 100 |
+
"technologies for grid and other energy storage applications due to their cost benefits " \
|
| 101 |
+
"and sustainable resource supply. For the cathode—the component that largely determines the " \
|
| 102 |
+
"energy density of a sodium-ion battery cell—one major category of materials is P2-type layered oxides."
|
| 103 |
+
res = nlp(input_string)
|
| 104 |
+
|
| 105 |
+
# Load model & tokenizer
|
| 106 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 107 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 108 |
+
|