jjsprockel
commited on
Commit
•
2c44003
1
Parent(s):
a22c176
Update README.md
Browse files
README.md
CHANGED
@@ -17,6 +17,57 @@ tags:
|
|
17 |
- **License:** apache-2.0
|
18 |
- **Finetuned from model :** unsloth/llama-3-8b-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)
|
|
|
17 |
- **License:** apache-2.0
|
18 |
- **Finetuned from model :** unsloth/llama-3-8b-bnb-4bit
|
19 |
|
20 |
+
**Código para descarga:**
|
21 |
+
El siguiente es el código sugerido para descargar el modelo usando Unslot:
|
22 |
+
|
23 |
+
```
|
24 |
+
import torch
|
25 |
+
from unsloth import FastLanguageModel
|
26 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
27 |
+
model_name = "jjsprockel/Patologia_lora_model1", # YOUR MODEL YOU USED FOR TRAINING
|
28 |
+
max_seq_length = 2048, # Choose any! Llama 3 is up to 8k
|
29 |
+
dtype = None,
|
30 |
+
load_in_4bit = True,
|
31 |
+
)
|
32 |
+
|
33 |
+
FastLanguageModel.for_inference(model)
|
34 |
+
|
35 |
+
alpaca_prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
36 |
+
|
37 |
+
### Instruction:
|
38 |
+
{}
|
39 |
+
|
40 |
+
### Input:
|
41 |
+
{}
|
42 |
+
|
43 |
+
### Response:
|
44 |
+
{}"""
|
45 |
+
|
46 |
+
```
|
47 |
+
|
48 |
+
**Código para la inferencia:**
|
49 |
+
|
50 |
+
# Get the instruction from the console
|
51 |
+
El siguiente codigo demuestra como se puede llevar a cabo la inferencia.
|
52 |
+
|
53 |
+
```
|
54 |
+
instruction = input("Ingresa la pregunta que tengas de Patología: ")
|
55 |
+
|
56 |
+
inputs = tokenizer(
|
57 |
+
[
|
58 |
+
alpaca_prompt.format(
|
59 |
+
instruction, # instruction
|
60 |
+
"", # input
|
61 |
+
"", # output - leave this blank for generation!
|
62 |
+
)
|
63 |
+
], return_tensors = "pt").to("cuda")
|
64 |
+
|
65 |
+
from transformers import TextStreamer
|
66 |
+
text_streamer = TextStreamer(tokenizer)
|
67 |
+
_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 2048)
|
68 |
+
|
69 |
+
```
|
70 |
+
|
71 |
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
72 |
|
73 |
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|