Upload README.md with huggingface_hub
Browse files
README.md
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- es
|
4 |
+
tags:
|
5 |
+
- conversational
|
6 |
+
- llama2
|
7 |
+
---
|
8 |
+
LlamaDos is a model oriented to have conversations in Spanish. It results from a finetuning of the Llama2-7b model by Meta using various optimization techniques such as LoRa, quantization, gradient accumulation and much more.
|
9 |
+
|
10 |
+
This has allowed the training to be performed on a single consumer graph (RTX 3090). More specifically, more than 250,000 conversational data were used and the training took approximately 140 hours.
|
11 |
+
|
12 |
+
More info on github: https://github.com/Garrachonr/LlamaDos
|
13 |
+
|
14 |
+
The training has been performed following the original data structure of the Llama2 paper, so it is recommended to follow the same structure for inference:
|
15 |
+
|
16 |
+
```python
|
17 |
+
<s>[INST] <<SYS>>
|
18 |
+
{{ You are a helpful, respectful and honest conversational assistant. Have a conversation with the user in a natural way. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. }}
|
19 |
+
<</SYS>>
|
20 |
+
|
21 |
+
{{ user_msg_1 }} [/INST] {{ model_answer_1 }} </s><s>[INST] {{ user_msg_2 }} [/INST] {{ model_answer_1 }} </s>
|
22 |
+
```
|
23 |
+
|
24 |
+
In order to use this model:
|
25 |
+
|
26 |
+
```python
|
27 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
28 |
+
base_model = AutoModelForCausalLM.from_pretrained(
|
29 |
+
"garrachonr/llamaDos",
|
30 |
+
low_cpu_mem_usage=True,
|
31 |
+
return_dict=True,
|
32 |
+
torch_dtype=torch.float16,
|
33 |
+
device_map=device_map,
|
34 |
+
)
|
35 |
+
tokenizer = AutoTokenizer.from_pretrained("garrachonr/llamaDos", trust_remote_code=True)
|
36 |
+
tokenizer.pad_token = tokenizer.eos_token
|
37 |
+
tokenizer.padding_side = "right"
|
38 |
+
|
39 |
+
# Run text generation pipeline with llamaDos
|
40 |
+
system_prompt = "You are a helpful, respectful and honest conversational assistant. Have a conversation with the user in a natural way. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature."
|
41 |
+
prompt1 = "Acabo de adoptar un perro"
|
42 |
+
prompt2 = "Muy buena decisión, te gustan los perros?"
|
43 |
+
prompt3 = "Si, cuando era pequeño tenía uno y ahora he podido adoptar otro"
|
44 |
+
text = "<s>[INST] <<SYS>> {} <</SYS>> {} [/INST] {} </s><s>[INST] {} [/INST]".format(system_prompt, prompt1, prompt2, prompt3)
|
45 |
+
pipe = pipeline(task="text-generation", model=base_model, tokenizer=tokenizer, max_length=200)
|
46 |
+
result = pipe(text)
|
47 |
+
print(result[0]['generated_text'])
|
48 |
+
```
|
49 |
+
|
50 |
+
|
51 |
+
This work is funded by the Comunidad de Madrid through the call Research Grants for Young Investigators from Universidad Politécnica de Madrid (GENIUS:APOYO-JOVENES-21-TAXTYC-32-K61X37), and supported by the following projects: European Commission through Project ASTOUND (101071191–-HORIZON-EIC-2021-PATHFINDERCHALLENGES-01) and BEWORD (PID2021-126061OB-C43) funded by
|
52 |
+
MCIN/AEI/10.13039/501100011033 and, as appropriate, by “ERDF A way of making Europe”, by the
|
53 |
+
“European Union”.
|
54 |
+
|
55 |
+
We also want to give thanks to MS Azure services (especially to Irving Kwong) for their sponsorship to translate into Spanish all dialogue databases.
|