rafaelgeraldini commited on
Commit
23b5a0d
1 Parent(s): 96dff0f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +54 -73
README.md CHANGED
@@ -1,26 +1,31 @@
1
  ---
 
 
 
 
2
  language:
3
  - pt
4
- license: llama2
5
- library_name: transformers
6
  tags:
7
- - code
8
  - analytics
9
  - analise-dados
10
  - portugues-BR
11
- base_model: codellama/CodeLlama-7b-Instruct-hf
12
- datasets:
13
- - semantixai/Test-Dataset-Lloro
 
 
 
 
14
  ---
15
 
16
  **Lloro 7B**
17
 
18
  <img src="https://cdn-uploads.huggingface.co/production/uploads/653176dc69fffcfe1543860a/h0kNd9OTEu1QdGNjHKXoq.png" width="300" alt="Lloro-7b Logo"/>
19
 
 
 
20
 
21
- Lloro, developed by Semantix Research Labs , is a language Model that was trained to effectively perform Portuguese Data Analysis in Python. It is a fine-tuned version of codellama/CodeLlama-7b-Instruct-hf, that was trained on synthetic datasets . The fine-tuning process was performed using the QLORA metodology on a GPU V100 with 16 GB of RAM.
22
 
23
-
24
 
25
  **Model description**
26
 
@@ -31,7 +36,7 @@ Language(s) (NLP): Primarily Portuguese, but the model is capable to understand
31
 
32
  Finetuned from model: codellama/CodeLlama-7b-Instruct-hf
33
 
34
-
35
 
36
  **What is Lloro's intended use(s)?**
37
 
@@ -42,127 +47,103 @@ Input : Text
42
 
43
  Output : Text (Code)
44
 
 
 
 
45
 
46
  **Usage**
47
 
48
  Using Transformers
 
49
  ```python
50
  #Import required libraries
51
  import torch
52
- from transformers import (
53
- AutoModelForCausalLM,
54
- AutoTokenizer
55
  )
56
 
57
  #Load Model
58
- model_name = "semantixai/LloroV2"
59
  base_model = AutoModelForCausalLM.from_pretrained(
60
  model_name,
61
  return_dict=True,
62
- torch_dtype=torch.float16,
63
- device_map="auto",
64
- )
65
-
66
- #Load Tokenizer
67
- tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
68
-
69
-
70
- #Define Prompt
71
- user_prompt = "Desenvolva um algoritmo em Python para calcular a média e a mediana dos preços de vendas por tipo de material do produto."
72
- system = "Provide answers in Python without explanations, only the code"
73
- prompt_template = f"[INST] <<SYS>>\\n{system}\\n<</SYS>>\\n\\n{user_prompt}[/INST]"
74
-
75
- #Call the model
76
- input_ids = tokenizer([prompt_template], return_tensors="pt")["input_ids"].to("cuda")
77
-
78
-
79
- outputs = base_model.generate(
80
  input_ids,
81
  do_sample=True,
82
  top_p=0.95,
83
- max_new_tokens=1024,
84
  temperature=0.1,
85
  )
86
 
87
- #Decode and retrieve Output
88
- output_text = tokenizer.batch_decode(outputs, skip_prompt=True, skip_special_tokens=False)
89
- display(output_text)
90
  ```
91
 
92
  Using an OpenAI compatible inference server (like [vLLM](https://docs.vllm.ai/en/latest/index.html))
 
93
  ```python
94
  from openai import OpenAI
95
 
96
- client = OpenAI(
97
- api_key="EMPTY",
98
  base_url="http://localhost:8000/v1",
99
  )
100
  user_prompt = "Desenvolva um algoritmo em Python para calcular a média e a mediana dos preços de vendas por tipo de material do produto."
101
- completion = client.chat.completions.create(temperature=0.1,frequency_penalty=0.1,model="semantixai/LloroV2",messages=[{"role":"system","content":"Provide answers in Python without explanations, only the code"},{"role":"user","content":user_prompt}])
102
  ```
103
-
104
 
105
  **Params**
106
  Training Parameters
107
- | Params | Training Data | Examples | Tokens | LR |
108
- |----------------------------------|---------------------------------|---------------------------------|----------|--------|
109
- | 7B | Pairs synthetic instructions/code | 28907 | 3 031 188 | 1e-5 |
110
-
111
 
112
  **Model Sources**
113
 
114
- Test Dataset Repository: https://huggingface.co/datasets/semantixai/Test-Dataset-Lloro
 
115
 
116
- Model Dates Lloro was trained between November 2023 and January 2024.
117
 
118
-
119
 
120
  **Performance**
121
  | Modelo | LLM as Judge | Code Bleu Score | Rouge-L | CodeBert- Precision | CodeBert-Recall | CodeBert-F1 | CodeBert-F3 |
122
  |----------------|--------------|------------------|---------|----------------------|-----------------|-------------|-------------|
123
- | GPT 3.5 | 91.22% | 0.2745 | 0.2189 | 0.7502 | 0.7146 | 0.7303 | 0.7175 |
124
- | Instruct -Base | 97.40% | 0.2487 | 0.1146 | 0.6997 | 0.6473 | 0.6713 | 0.6518 |
125
- | Instruct -FT | 97.76% | 0.3264 | 0.3602 | 0.7942 | 0.8178 | 0.8042 | 0.8147 |
126
 
127
 
128
  **Training Infos:**
129
  The following hyperparameters were used during training:
130
 
131
- | Parameter | Value |
132
- |---------------------------|----------------------|
133
- | learning_rate | 1e-5 |
134
- | weight_decay | 0.0001 |
135
- | train_batch_size | 1 |
136
- | eval_batch_size | 1 |
137
- | seed | 42 |
138
  | optimizer | Adam - paged_adamw_32bit |
139
- | lr_scheduler_type | cosine |
140
- | lr_scheduler_warmup_ratio | 0.03 |
141
- | num_epochs | 5.0 |
142
 
143
  **QLoRA hyperparameters**
144
  The following parameters related with the Quantized Low-Rank Adaptation and Quantization were used during training:
145
 
146
- | Parameter | Value |
147
- |------------------|---------|
148
- | lora_r | 16 |
149
- | lora_alpha | 64 |
150
- | lora_dropout | 0.1 |
151
- | storage_dtype | "nf4" |
152
- | compute_dtype | "float16"|
153
 
154
 
155
  **Experiments**
156
- | Model | Epochs | Overfitting | Final Epochs | Training Hours | CO2 Emission (Kg) |
157
- |-----------------------|--------|-------------|--------------|-----------------|--------------------|
158
- | Code Llama Instruct | 1 | No | 1 | 8.1 | 1.337 |
159
- | Code Llama Instruct | 5 | Yes | 3 | 45.6 | 9.12 |
160
 
161
  **Framework versions**
162
 
163
- | Library | Version |
164
- |---------------|-----------|
165
- | bitsandbytes | 0.40.2 |
166
  | Datasets | 2.14.3 |
167
  | Pytorch | 2.0.1 |
168
  | Tokenizers | 0.14.1 |
 
1
  ---
2
+ base_model: codellama/CodeLlama-7b-Instruct-hf
3
+ license: llama2
4
+ datasets:
5
+ - semantixai/LloroV3
6
  language:
7
  - pt
 
 
8
  tags:
 
9
  - analytics
10
  - analise-dados
11
  - portugues-BR
12
+
13
+ co2_eq_emissions:
14
+ emissions: 1320
15
+ source: "Lacoste, Alexandre, et al. “Quantifying the Carbon Emissions of Machine Learning.” ArXiv (Cornell University), 21 Oct. 2019, https://doi.org/10.48550/arxiv.1910.09700."
16
+ training_type: "fine-tuning"
17
+ geographical_location: "Council Bluffs, Iowa, USA."
18
+ hardware_used: "1 A100 40GB GPU"
19
  ---
20
 
21
  **Lloro 7B**
22
 
23
  <img src="https://cdn-uploads.huggingface.co/production/uploads/653176dc69fffcfe1543860a/h0kNd9OTEu1QdGNjHKXoq.png" width="300" alt="Lloro-7b Logo"/>
24
 
25
+ Lloro, developed by Semantix Research Labs , is a language Model that was trained to effectively perform Portuguese Data Analysis in Python. It is a fine-tuned version of codellama/CodeLlama-7b-Instruct-hf, that was trained on synthetic datasets. The fine-tuning process was performed using the QLORA metodology on a GPU A100 with 40 GB of RAM.
26
+
27
 
 
28
 
 
29
 
30
  **Model description**
31
 
 
36
 
37
  Finetuned from model: codellama/CodeLlama-7b-Instruct-hf
38
 
39
+
40
 
41
  **What is Lloro's intended use(s)?**
42
 
 
47
 
48
  Output : Text (Code)
49
 
50
+ **V3 Release**
51
+ - Context Lenght increased to 2048.
52
+ - Fine-tuning dataset increased to 74222 examples.
53
 
54
  **Usage**
55
 
56
  Using Transformers
57
+
58
  ```python
59
  #Import required libraries
60
  import torch
 
 
 
61
  )
62
 
63
  #Load Model
64
+ model_name = "semantixai/Lloro"
65
  base_model = AutoModelForCausalLM.from_pretrained(
66
  model_name,
67
  return_dict=True,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  input_ids,
69
  do_sample=True,
70
  top_p=0.95,
71
+ max_new_tokens=2048,
72
  temperature=0.1,
73
  )
74
 
 
 
 
75
  ```
76
 
77
  Using an OpenAI compatible inference server (like [vLLM](https://docs.vllm.ai/en/latest/index.html))
78
+
79
  ```python
80
  from openai import OpenAI
81
 
 
 
82
  base_url="http://localhost:8000/v1",
83
  )
84
  user_prompt = "Desenvolva um algoritmo em Python para calcular a média e a mediana dos preços de vendas por tipo de material do produto."
85
+ completion = client.chat.completions.create(temperature=0.1,frequency_penalty=0.1,model="semantixai/Lloro",messages=[{"role":"system","content":"Provide answers in Python without explanations, only the code"},{"role":"user","content":user_prompt}])
86
  ```
87
+
88
 
89
  **Params**
90
  Training Parameters
91
+ | Params | Training Data | Examples | Tokens | LR |
92
+ |----------------------------------|-----------------------------------|---------------------------------|----------|--------|
93
+ | 7B | Pairs synthetic instructions/code | 74222 | 9 351 532| 2e-4 |
94
+
95
 
96
  **Model Sources**
97
 
98
+ Test Dataset Repository: <https://huggingface.co/datasets/semantixai/LloroV3>
99
+
100
 
 
101
 
102
+ Model Dates: Lloro was trained between February 2024 and April 2024.
103
 
104
  **Performance**
105
  | Modelo | LLM as Judge | Code Bleu Score | Rouge-L | CodeBert- Precision | CodeBert-Recall | CodeBert-F1 | CodeBert-F3 |
106
  |----------------|--------------|------------------|---------|----------------------|-----------------|-------------|-------------|
107
+ | GPT 3.5 | 94.29% | 0.3538 | 0.3756 | 0.8099 | 0.8176 | 0.8128 | 0.8164 |
108
+ | Instruct -Base | 88.77% | 0.3666 | 0.3351 | 0.8244 | 0.8025 | 0.8121 | 0.8052 |
109
+ | Instruct -FT | 97.95% | 0.5967 | 0.6717 | 0.9090 | 0.9182 | 0.9131 | 0.9171 |
110
 
111
 
112
  **Training Infos:**
113
  The following hyperparameters were used during training:
114
 
115
+ | Parameter | Value |
116
+ |---------------------------|--------------------------|
117
+ | learning_rate | 2e-4 |
118
+ | weight_decay | 0.0001 |
119
+ | train_batch_size | 7 |
120
+ | eval_batch_size | 7 |
121
+ | seed | 42 |
122
  | optimizer | Adam - paged_adamw_32bit |
123
+ | lr_scheduler_type | cosine |
124
+ | lr_scheduler_warmup_ratio | 0.06 |
125
+ | num_epochs | 4.0 |
126
 
127
  **QLoRA hyperparameters**
128
  The following parameters related with the Quantized Low-Rank Adaptation and Quantization were used during training:
129
 
130
+ | Parameter | Value |
131
+ |------------------|-----------|
132
+ | lora_r | 64 |
133
+ | lora_alpha | 256 |
134
+ | lora_dropout | 0.1 |
135
+ | storage_dtype | "nf4" |
136
+ | compute_dtype | "bfloat16"|
137
 
138
 
139
  **Experiments**
140
+ | Model | Epochs | Overfitting | Final Epochs | Training Hours | CO2 Emission (Kg) |
141
+ |-----------------------|--------|-------------|--------------|-----------------|-------------------|
142
+ | Code Llama Instruct | 1 | No | 1 | 3.01 | 0.43 |
143
+ | Code Llama Instruct | 4 | Yes | 3 | 9.25 | 1.32 |
144
 
145
  **Framework versions**
146
 
 
 
 
147
  | Datasets | 2.14.3 |
148
  | Pytorch | 2.0.1 |
149
  | Tokenizers | 0.14.1 |