shahrukhx01 commited on
Commit
41a4553
1 Parent(s): 1a88651

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +17 -0
README.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ```python
2
+ from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
3
+
4
+ model_name = "shahrukhx01/chemical-bert-uncased-squad2"
5
+
6
+ # a) Get predictions
7
+ nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
8
+ QA_input = {
9
+ 'question': 'Why is model conversion important?',
10
+ 'context': 'The option to convert models between pytorch and transformers gives freedom to the user and let people easily switch between frameworks.'
11
+ }
12
+ res = nlp(QA_input)
13
+
14
+ # b) Load model & tokenizer
15
+ model = AutoModelForQuestionAnswering.from_pretrained(model_name)
16
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
17
+ ```