File size: 1,915 Bytes
6f88b1a
 
 
 
 
 
 
 
 
 
 
 
 
0649f21
 
 
 
 
6f88b1a
 
 
 
 
 
2c44003
 
 
 
 
 
 
0649f21
2c44003
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6f88b1a
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
base_model: unsloth/llama-3-8b-bnb-4bit
language:
- en
license: apache-2.0
tags:
- text-generation-inference
- transformers
- unsloth
- llama
- trl
---

# LLM basado en LLaMA Ajustado al Dominio de Patolog铆a

Primera Versi贸n de un LLM ajustado para responder preguntas de Patolog铆a


# Uploaded  model

- **Developed by:** jjsprockel
- **License:** apache-2.0
- **Finetuned from model :** unsloth/llama-3-8b-bnb-4bit

**C贸digo para descarga:**
El siguiente es el c贸digo sugerido para descargar el modelo usando Unslot:

```
import torch
from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained(
    model_name = "jjsprockel/Patologia_lora_model1",
    max_seq_length = 2048, # Choose any! Llama 3 is up to 8k
    dtype = None,
    load_in_4bit = True,
    )

FastLanguageModel.for_inference(model)

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.

### Instruction:
{}

### Input:
{}

### Response:
{}"""

```

**C贸digo para la inferencia:**

El siguiente codigo demuestra como se puede llevar a cabo la inferencia.

```
instruction = input("Ingresa la pregunta que tengas de Patolog铆a: ")

inputs = tokenizer(
[
    alpaca_prompt.format(
        instruction, # instruction
        "", # input
        "", # output - leave this blank for generation!
    )
], return_tensors = "pt").to("cuda")

from transformers import TextStreamer
text_streamer = TextStreamer(tokenizer)
_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 2048)

```

This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.

[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)