yirenl2 commited on
Commit
e70afe4
1 Parent(s): f98cf20

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +17 -0
README.md CHANGED
@@ -32,3 +32,20 @@ model-index:
32
  # roberta-base for QA finetuned over community safety domain data
33
 
34
  We fine-tuned the roBERTa-based model (https://huggingface.co/deepset/roberta-base-squad2) over LiveSafe community safety dialogue data for event argument extraction with the objective of question-answering.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  # roberta-base for QA finetuned over community safety domain data
33
 
34
  We fine-tuned the roBERTa-based model (https://huggingface.co/deepset/roberta-base-squad2) over LiveSafe community safety dialogue data for event argument extraction with the objective of question-answering.
35
+
36
+
37
+ ### Using model in Transformers
38
+ ```python
39
+ from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
40
+ model_name = "yirenl2/plm_qa"
41
+ # a) Get predictions
42
+ nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
43
+ QA_input = {
44
+ 'question': 'What is the location of the incident?',
45
+ 'context': 'I was attacked by someone in front of the bus station.'
46
+ }
47
+ res = nlp(QA_input)
48
+ # b) Load model & tokenizer
49
+ model = AutoModelForQuestionAnswering.from_pretrained(model_name)
50
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
51
+ ```