InferenceLab
commited on
Update README.md
Browse files
README.md
CHANGED
|
@@ -62,15 +62,27 @@ Users should validate outputs with certified medical professionals. This model i
|
|
| 62 |
## How to Get Started with the Model
|
| 63 |
|
| 64 |
```python
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
|
|
|
| 62 |
## How to Get Started with the Model
|
| 63 |
|
| 64 |
```python
|
| 65 |
+
import torch
|
| 66 |
+
from transformers import pipeline
|
| 67 |
+
|
| 68 |
+
model_id = "InferenceLab/MediLlama-3.2"
|
| 69 |
+
pipe = pipeline(
|
| 70 |
+
"text-generation",
|
| 71 |
+
model=model_id,
|
| 72 |
+
torch_dtype=torch.bfloat16,
|
| 73 |
+
device_map="auto",
|
| 74 |
+
)
|
| 75 |
+
|
| 76 |
+
messages = [
|
| 77 |
+
{"role": "system", "content": "You are a helpful Medical assistant."},
|
| 78 |
+
{"role": "user", "content": "Hi! How are you?"},
|
| 79 |
+
]
|
| 80 |
+
outputs = pipe(
|
| 81 |
+
messages,
|
| 82 |
+
max_new_tokens=256,
|
| 83 |
+
)
|
| 84 |
+
print(outputs[0]["generated_text"][-1])
|
| 85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
````
|
| 87 |
|
| 88 |
## Training Details
|