AbdelrahmanFakhry commited on
Commit
28dd3c1
·
1 Parent(s): c52f531

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +7 -5
README.md CHANGED
@@ -17,17 +17,18 @@ The model's output may be influenced by biases present in the training data, pot
17
 
18
  ```python
19
 
 
 
20
  checkpoint = "AbdelrahmanFakhry/finetuned-gpt2-multi-QA-Generation"
21
 
22
  tokenizer = AutoTokenizer.from_pretrained(checkpoint)
23
  model = GPT2LMHeadModel.from_pretrained(checkpoint)
24
  # Retrieve a test question from the test dataset
25
- test_text = test_dataset.to_dict()['question'][3]
26
- test_text
27
 
28
 
29
  # test_text should be like that
30
- '''Below is input text, the task is to generate questions from input text and multiple answers for
31
  each question and provide hint and correct answer for each question.\n\n### Input:\n<hl> Local intercellular
32
  communication is the province of the paracrine , also called a paracrine factor , which is a chemical that
33
  induces a response in neighboring cells . <hl> Although paracrines may enter the bloodstream , their concentration
@@ -76,8 +77,7 @@ def inference(text, model, tokenizer, max_input_tokens=3000, max_output_tokens=5
76
  return generated_text_answer
77
 
78
  generated_answer = inference(test_text, model, tokenizer)
79
- print('Generated Answer:')
80
- print(generated_answer)
81
  '''
82
  "Choices': ['paracrine factor', 'paracrine factor', 'paracrine factor II', 'paracrine factor III'],
83
  'Question': 'Which of the following is not a paracrine factor?',
@@ -85,6 +85,8 @@ print(generated_answer)
85
  'hint': 'Local intercellular communication is the province of the paracrine, also called a paracrine factor,
86
  which is a chemical that induces a response in neighboring cells."
87
  '''
 
 
88
  ```
89
 
90
  # Acknowledgments
 
17
 
18
  ```python
19
 
20
+ #!pip install transformers
21
+ from transformers import AutoTokenizer, GPT2LMHeadModel
22
  checkpoint = "AbdelrahmanFakhry/finetuned-gpt2-multi-QA-Generation"
23
 
24
  tokenizer = AutoTokenizer.from_pretrained(checkpoint)
25
  model = GPT2LMHeadModel.from_pretrained(checkpoint)
26
  # Retrieve a test question from the test dataset
27
+ #test_text = test_dataset.to_dict()['question'][3]
 
28
 
29
 
30
  # test_text should be like that
31
+ test_text = '''Below is input text, the task is to generate questions from input text and multiple answers for
32
  each question and provide hint and correct answer for each question.\n\n### Input:\n<hl> Local intercellular
33
  communication is the province of the paracrine , also called a paracrine factor , which is a chemical that
34
  induces a response in neighboring cells . <hl> Although paracrines may enter the bloodstream , their concentration
 
77
  return generated_text_answer
78
 
79
  generated_answer = inference(test_text, model, tokenizer)
80
+ #Generated Answer should be look like that:
 
81
  '''
82
  "Choices': ['paracrine factor', 'paracrine factor', 'paracrine factor II', 'paracrine factor III'],
83
  'Question': 'Which of the following is not a paracrine factor?',
 
85
  'hint': 'Local intercellular communication is the province of the paracrine, also called a paracrine factor,
86
  which is a chemical that induces a response in neighboring cells."
87
  '''
88
+ print('Generated Answer:')
89
+ print(generated_answer)
90
  ```
91
 
92
  # Acknowledgments