Vidyuth commited on
Commit
35d935d
1 Parent(s): e096bdc

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +37 -39
README.md CHANGED
@@ -1,41 +1,11 @@
1
  ---
2
  library_name: transformers
3
- tags: ['-medical']
 
 
 
4
  ---
5
 
6
- ## Quickstart
7
-
8
- ```python
9
- import torch
10
- from transformers import GPT2LMHeadModel, GPT2Tokenizer
11
-
12
-
13
- path = "Vidyuth/GPT2-finetuned-medical-instructions"
14
- device = "cuda" if torch.cuda.is_available() else "cpu"
15
- tokenizer = GPT2Tokenizer.from_pretrained(path)
16
- model = GPT2LMHeadModel.from_pretrained(path).to(device)
17
-
18
- prompt_input = (
19
- "The conversation between human and AI assistant.\n"
20
- "[|Human|] {input}\n"
21
- "[|AI|]"
22
- )
23
- sentence = prompt_input.format_map({'input': "what is parkinson's disease?"})
24
- inputs = tokenizer(sentence, return_tensors="pt").to(device)
25
-
26
- with torch.no_grad():
27
- beam_output = model.generate(**inputs,
28
- min_new_tokens=1,
29
- max_length=512,
30
- num_beams=3,
31
- repetition_penalty=1.2,
32
- early_stopping=True,
33
- eos_token_id=198
34
- )
35
- print(tokenizer.decode(beam_output[0], skip_special_tokens=True))
36
- ```
37
-
38
-
39
  ## Model Details
40
 
41
  ### Model Description
@@ -56,7 +26,7 @@ This is the model card of a 🤗 transformers model that has been pushed on the
56
 
57
  <!-- Provide the basic links for the model. -->
58
 
59
- - **Repository:** [More Information Needed]
60
  - **Paper [optional]:** [More Information Needed]
61
  - **Demo [optional]:** [More Information Needed]
62
 
@@ -97,7 +67,37 @@ Users (both direct and downstream) should be made aware of the risks, biases and
97
  ## How to Get Started with the Model
98
 
99
 
100
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
 
102
  ## Training Details
103
 
@@ -222,6 +222,4 @@ Carbon emissions can be estimated using the [Machine Learning Impact calculator]
222
 
223
  ## Model Card Contact
224
 
225
- [More Information Needed]
226
-
227
-
 
1
  ---
2
  library_name: transformers
3
+ tags:
4
+ - '-medical'
5
+ datasets:
6
+ - Mohammed-Altaf/medical-instruction-120k
7
  ---
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  ## Model Details
10
 
11
  ### Model Description
 
26
 
27
  <!-- Provide the basic links for the model. -->
28
 
29
+ - **Repository:** [https://huggingface.co/jianghc/medical_chatbot]
30
  - **Paper [optional]:** [More Information Needed]
31
  - **Demo [optional]:** [More Information Needed]
32
 
 
67
  ## How to Get Started with the Model
68
 
69
 
70
+
71
+ ```python
72
+ import torch
73
+ from transformers import GPT2LMHeadModel, GPT2Tokenizer
74
+
75
+
76
+ path = "Vidyuth/GPT2-finetuned-medical-instructions"
77
+ device = "cuda" if torch.cuda.is_available() else "cpu"
78
+ tokenizer = GPT2Tokenizer.from_pretrained(path)
79
+ model = GPT2LMHeadModel.from_pretrained(path).to(device)
80
+
81
+ prompt_input = (
82
+ "The conversation between human and AI assistant.\n"
83
+ "[|Human|] {input}\n"
84
+ "[|AI|]"
85
+ )
86
+ sentence = prompt_input.format_map({'input': "what is parkinson's disease?"})
87
+ inputs = tokenizer(sentence, return_tensors="pt").to(device)
88
+
89
+ with torch.no_grad():
90
+ beam_output = model.generate(**inputs,
91
+ min_new_tokens=1,
92
+ max_length=512,
93
+ num_beams=3,
94
+ repetition_penalty=1.2,
95
+ early_stopping=True,
96
+ eos_token_id=198
97
+ )
98
+ print(tokenizer.decode(beam_output[0], skip_special_tokens=True))
99
+ ```
100
+
101
 
102
  ## Training Details
103
 
 
222
 
223
  ## Model Card Contact
224
 
225
+ [More Information Needed]