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