malhajar commited on
Commit
faccb86
1 Parent(s): ece9e5e

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +56 -0
README.md ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ tags:
5
+ - Medicine
6
+ ---
7
+ # Model Card for Model ID
8
+
9
+ <!-- Provide a quick summary of what the model is/does. -->
10
+ meditron-7b-chat is a finetuned version of [`epfl-llm/meditron-7b`](https://huggingface.co/epfl-llm/meditron-7b) using SFT Training.
11
+ This model can answer information about different excplicit ideas in medicine (see [`epfl-llm/meditron-7b`](https://huggingface.co/epfl-llm/meditron-7b) for more info)
12
+
13
+ ### Model Description
14
+
15
+ - **Finetuned by:** [`Mohamad Alhajar`](https://www.linkedin.com/in/muhammet-alhajar/)
16
+ - **Language(s) (NLP):** English
17
+ - **Finetuned from model:** [`epfl-llm/meditron-7b`](https://huggingface.co/epfl-llm/meditron-7b)
18
+
19
+ ### Prompt Template
20
+ ```
21
+ ### Instruction:
22
+
23
+ <prompt> (without the <>)
24
+
25
+ ### Response:
26
+ ```
27
+
28
+
29
+ ## How to Get Started with the Model
30
+
31
+ Use the code sample provided in the original post to interact with the model.
32
+ ```python
33
+ from transformers import AutoTokenizer,AutoModelForCausalLM
34
+
35
+ model_id = "malhajar/meditron-7b-chat"
36
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
37
+ device_map="auto",
38
+ torch_dtype=torch.float16,
39
+ revision="main")
40
+
41
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
42
+
43
+ question: "what is tract infection?"
44
+ # For generating a response
45
+ prompt = '''
46
+ ### Instruction:
47
+ {question}
48
+
49
+ ### Response:'''
50
+ input_ids = tokenizer(prompt, return_tensors="pt").input_ids
51
+ output = model.generate(inputs=input_ids,max_new_tokens=512,pad_token_id=tokenizer.eos_token_id,top_k=50, do_sample=True,
52
+ top_p=0.95)
53
+ response = tokenizer.decode(output[0])
54
+
55
+ print(response)
56
+ ```