garrachonr commited on
Commit
34e9ced
·
1 Parent(s): d9fe8cf

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +37 -2
README.md CHANGED
@@ -1,14 +1,49 @@
 
 
 
 
 
 
 
1
  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.
2
 
3
  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.
4
 
5
  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:
6
 
7
- "<s>[INST] <<SYS>>
 
8
  {{ 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. }}
9
  <</SYS>>
10
 
11
- {{ user_msg_1 }} [/INST] {{ model_answer_1 }} </s><s>[INST] {{ user_msg_2 }} [/INST]"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
 
14
  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
 
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
  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:
13
 
14
+ ```python
15
+ <s>[INST] <<SYS>>
16
  {{ 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. }}
17
  <</SYS>>
18
 
19
+ {{ user_msg_1 }} [/INST] {{ model_answer_1 }} </s><s>[INST] {{ user_msg_2 }} [/INST] {{ model_answer_1 }} </s>
20
+ ```
21
+
22
+ In order to use this model:
23
+
24
+ ```python
25
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
26
+ base_model = AutoModelForCausalLM.from_pretrained(
27
+ "garrachonr/llamaDos",
28
+ low_cpu_mem_usage=True,
29
+ return_dict=True,
30
+ torch_dtype=torch.float16,
31
+ device_map=device_map,
32
+ )
33
+ tokenizer = AutoTokenizer.from_pretrained("garrachonr/llamaDos", trust_remote_code=True)
34
+ tokenizer.pad_token = tokenizer.eos_token
35
+ tokenizer.padding_side = "right"
36
+
37
+ # Run text generation pipeline with llamaDos
38
+ 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."
39
+ prompt1 = "Acabo de adoptar un perro"
40
+ prompt2 = "Muy buena decisión, te gustan los perros?"
41
+ prompt3 = "Si, cuando era pequeño tenía uno y ahora he podido adoptar otro"
42
+ text = "<s>[INST] <<SYS>> {} <</SYS>> {} [/INST] {} </s><s>[INST] {} [/INST]".format(system_prompt, prompt1, prompt2, prompt3)
43
+ pipe = pipeline(task="text-generation", model=base_model, tokenizer=tokenizer, max_length=200)
44
+ result = pipe(text)
45
+ print(result[0]['generated_text'])
46
+ ```
47
 
48
 
49
  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