Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
---
|
| 4 |
+
|
| 5 |
+
Causality detection model fine-tuned on both self-labeled data and both the training and dev sets from the Causal News Corpus (https://github.com/tanfiona/CausalNewsCorpus/tree/master/data).
|
| 6 |
+
|
| 7 |
+
Usage (Causality Inference):
|
| 8 |
+
|
| 9 |
+
import transformers
|
| 10 |
+
|
| 11 |
+
import torch
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
model = AutoModelForSequenceClassification.from_pretrained('adamnik/roberta-causality-self-train')
|
| 15 |
+
|
| 16 |
+
tokenizer = AutoTokenizer.from_pretrained('roberta-base-cased')
|
| 17 |
+
|
| 18 |
+
sentence = "Last summer , tens of thousands of people in the northeastern city of Dalian , Liaoning , marched to demand the relocation of a chemical plant."
|
| 19 |
+
|
| 20 |
+
input = tokenizer(sentence, return_tensors='pt')
|
| 21 |
+
|
| 22 |
+
with torch.no_grad():
|
| 23 |
+
outputs = model(**input)
|
| 24 |
+
|
| 25 |
+
predictions = torch.argmax(outputs.logits, dim=-1)
|