zjiayao commited on
Commit
5cf26b0
1 Parent(s): c316f5e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +38 -0
README.md CHANGED
@@ -1,3 +1,41 @@
1
  ---
2
  license: mit
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
  ---
4
+ # roberta-temporal-predictor
5
+ A RoBERTa-base model that is fine-tuned on the [The New York Times Annotated Corpus](https://catalog.ldc.upenn.edu/LDC2008T19)
6
+ to predict temporal precedence of two events. This is used as the ``temporality prediction'' component
7
+ in our ROCK framework for reasoning about commonsense causality. See our [paper](https://arxiv.org/abs/2202.00436) for more details.
8
+
9
+ # Usage
10
+
11
+ For simplicity, we implement the following TempPredictor class. Example usage using the ``TempPredictor`` class:
12
+ ```python
13
+ from transformers import (RobertaForMaskedLM, RobertaTokenizer)
14
+ from src.temp_predictor import TempPredictor
15
+
16
+ TORCH_DEV = "cuda:0" # change as needed
17
+
18
+ tp_roberta_ft = src.TempPredictor(
19
+ model=RobertaForMaskedLM.from_pretrained("CogComp/roberta-temporal-predictor"),
20
+ tokenizer=RobertaTokenizer.from_pretrained("CogComp/roberta-temporal-predictor"),
21
+ device=TORCH_DEV
22
+ )
23
+
24
+ E1 = "The man turned on the faucet."
25
+ E2 = "Water flows out."
26
+ t12 = tp_roberta_ft(E1, E2, top_k=5)
27
+ print(f"P('{E1}' before '{E2}'): {t12}")
28
+ ```
29
+
30
+ # BibTeX entry and citation info
31
+
32
+ ```bib
33
+ @misc{zhang2022causal,
34
+ title={Causal Inference Principles for Reasoning about Commonsense Causality},
35
+ author={Jiayao Zhang and Hongming Zhang and Dan Roth and Weijie J. Su},
36
+ year={2022},
37
+ eprint={2202.00436},
38
+ archivePrefix={arXiv},
39
+ primaryClass={cs.CL}
40
+ }
41
+ ```