Update README.md
Browse files
README.md
CHANGED
@@ -11,12 +11,41 @@ tags:
|
|
11 |
- trl
|
12 |
---
|
13 |
|
14 |
-
#
|
15 |
|
16 |
- **Developed by:** Svngoku
|
17 |
- **License:** apache-2.0
|
18 |
- **Finetuned from model :** unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
21 |
|
22 |
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
|
|
11 |
- trl
|
12 |
---
|
13 |
|
14 |
+
# Llama-3.1-8B AlpaCare MediInstruct
|
15 |
|
16 |
- **Developed by:** Svngoku
|
17 |
- **License:** apache-2.0
|
18 |
- **Finetuned from model :** unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit
|
19 |
|
20 |
+
## Inference with Unsloth
|
21 |
+
|
22 |
+
```py
|
23 |
+
if True:
|
24 |
+
from unsloth import FastLanguageModel
|
25 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
26 |
+
model_name = "Svngoku/Llama-3.1-8B-AlpaCare-MedInstruct",
|
27 |
+
max_seq_length = max_seq_length,
|
28 |
+
dtype = dtype,
|
29 |
+
load_in_4bit = load_in_4bit,
|
30 |
+
)
|
31 |
+
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
|
32 |
+
|
33 |
+
# alpaca_prompt = You MUST copy from above!
|
34 |
+
|
35 |
+
inputs = tokenizer(
|
36 |
+
[
|
37 |
+
alpaca_prompt.format(
|
38 |
+
"Write an argument emphasizing the importance of ethical considerations in medical research.", # instruction
|
39 |
+
"", # input
|
40 |
+
"", # output - leave this blank for generation!
|
41 |
+
)
|
42 |
+
], return_tensors = "pt").to("cuda")
|
43 |
+
|
44 |
+
from transformers import TextStreamer
|
45 |
+
text_streamer = TextStreamer(tokenizer)
|
46 |
+
_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 800)
|
47 |
+
```
|
48 |
+
|
49 |
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
50 |
|
51 |
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|