InferenceLab
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -62,31 +62,15 @@ Users should validate outputs with certified medical professionals. This model i
|
|
62 |
## How to Get Started with the Model
|
63 |
|
64 |
```python
|
65 |
-
|
66 |
-
import torch
|
67 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
68 |
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
)
|
77 |
-
|
78 |
-
# Apply the chat template
|
79 |
-
messages = [
|
80 |
-
{"role": "system", "content": "You are a helpful AI assistant."},
|
81 |
-
{"role": "user", "content": "What are the symptoms of diabetes?"},
|
82 |
-
]
|
83 |
-
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
84 |
-
chat_input = tokenizer(prompt, return_tensors="pt").to(model.device)
|
85 |
-
|
86 |
-
# Generate response
|
87 |
-
chat_outputs = model.generate(**chat_input, max_new_tokens=500)
|
88 |
-
response = tokenizer.decode(chat_outputs[0][chat_input['input_ids'].shape[-1]:], skip_special_tokens=True) # Decode only the response part
|
89 |
-
print("\nAssistant Response:", response)
|
90 |
````
|
91 |
|
92 |
## Training Details
|
|
|
62 |
## How to Get Started with the Model
|
63 |
|
64 |
```python
|
|
|
|
|
65 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
66 |
|
67 |
+
model = AutoModelForCausalLM.from_pretrained("InferenceLab/MediLlama-3.2")
|
68 |
+
tokenizer = AutoTokenizer.from_pretrained("InferenceLab/MediLlama-3.2")
|
69 |
+
|
70 |
+
input_text = "What are the symptoms of diabetes?"
|
71 |
+
inputs = tokenizer(input_text, return_tensors="pt")
|
72 |
+
outputs = model.generate(**inputs)
|
73 |
+
print(tokenizer.decode(outputs[0]))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
````
|
75 |
|
76 |
## Training Details
|