Update README
Browse files
README.md
CHANGED
@@ -3,200 +3,91 @@ base_model: unsloth/gemma-7b-bnb-4bit
|
|
3 |
library_name: peft
|
4 |
---
|
5 |
|
6 |
-
#
|
7 |
|
8 |
-
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
12 |
-
##
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
-
|
21 |
-
- **
|
22 |
-
- **
|
23 |
-
- **
|
24 |
-
-
|
25 |
-
- **License:** [More Information Needed]
|
26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
27 |
-
|
28 |
-
### Model Sources [optional]
|
29 |
-
|
30 |
-
<!-- Provide the basic links for the model. -->
|
31 |
-
|
32 |
-
- **Repository:** [More Information Needed]
|
33 |
-
- **Paper [optional]:** [More Information Needed]
|
34 |
-
- **Demo [optional]:** [More Information Needed]
|
35 |
-
|
36 |
-
## Uses
|
37 |
-
|
38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
39 |
-
|
40 |
-
### Direct Use
|
41 |
-
|
42 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
43 |
-
|
44 |
-
[More Information Needed]
|
45 |
-
|
46 |
-
### Downstream Use [optional]
|
47 |
-
|
48 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
49 |
-
|
50 |
-
[More Information Needed]
|
51 |
-
|
52 |
-
### Out-of-Scope Use
|
53 |
-
|
54 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
55 |
-
|
56 |
-
[More Information Needed]
|
57 |
-
|
58 |
-
## Bias, Risks, and Limitations
|
59 |
-
|
60 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
61 |
-
|
62 |
-
[More Information Needed]
|
63 |
-
|
64 |
-
### Recommendations
|
65 |
|
66 |
-
|
67 |
|
68 |
-
|
|
|
69 |
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
-
|
73 |
|
74 |
-
|
75 |
|
76 |
## Training Details
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
81 |
-
|
82 |
-
[More Information Needed]
|
83 |
-
|
84 |
-
### Training Procedure
|
85 |
-
|
86 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
87 |
-
|
88 |
-
#### Preprocessing [optional]
|
89 |
-
|
90 |
-
[More Information Needed]
|
91 |
-
|
92 |
-
|
93 |
-
#### Training Hyperparameters
|
94 |
-
|
95 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
96 |
-
|
97 |
-
#### Speeds, Sizes, Times [optional]
|
98 |
-
|
99 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
100 |
-
|
101 |
-
[More Information Needed]
|
102 |
-
|
103 |
-
## Evaluation
|
104 |
-
|
105 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
106 |
-
|
107 |
-
### Testing Data, Factors & Metrics
|
108 |
-
|
109 |
-
#### Testing Data
|
110 |
-
|
111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
112 |
-
|
113 |
-
[More Information Needed]
|
114 |
-
|
115 |
-
#### Factors
|
116 |
-
|
117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
118 |
-
|
119 |
-
[More Information Needed]
|
120 |
-
|
121 |
-
#### Metrics
|
122 |
-
|
123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
124 |
-
|
125 |
-
[More Information Needed]
|
126 |
-
|
127 |
-
### Results
|
128 |
-
|
129 |
-
[More Information Needed]
|
130 |
-
|
131 |
-
#### Summary
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
## Model Examination [optional]
|
136 |
-
|
137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
138 |
-
|
139 |
-
[More Information Needed]
|
140 |
-
|
141 |
-
## Environmental Impact
|
142 |
-
|
143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
144 |
-
|
145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
146 |
-
|
147 |
-
- **Hardware Type:** [More Information Needed]
|
148 |
-
- **Hours used:** [More Information Needed]
|
149 |
-
- **Cloud Provider:** [More Information Needed]
|
150 |
-
- **Compute Region:** [More Information Needed]
|
151 |
-
- **Carbon Emitted:** [More Information Needed]
|
152 |
-
|
153 |
-
## Technical Specifications [optional]
|
154 |
-
|
155 |
-
### Model Architecture and Objective
|
156 |
-
|
157 |
-
[More Information Needed]
|
158 |
-
|
159 |
-
### Compute Infrastructure
|
160 |
-
|
161 |
-
[More Information Needed]
|
162 |
-
|
163 |
-
#### Hardware
|
164 |
-
|
165 |
-
[More Information Needed]
|
166 |
-
|
167 |
-
#### Software
|
168 |
-
|
169 |
-
[More Information Needed]
|
170 |
-
|
171 |
-
## Citation [optional]
|
172 |
-
|
173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
174 |
-
|
175 |
-
**BibTeX:**
|
176 |
-
|
177 |
-
[More Information Needed]
|
178 |
-
|
179 |
-
**APA:**
|
180 |
-
|
181 |
-
[More Information Needed]
|
182 |
-
|
183 |
-
## Glossary [optional]
|
184 |
-
|
185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
186 |
-
|
187 |
-
[More Information Needed]
|
188 |
-
|
189 |
-
## More Information [optional]
|
190 |
-
|
191 |
-
[More Information Needed]
|
192 |
-
|
193 |
-
## Model Card Authors [optional]
|
194 |
|
195 |
-
|
|
|
196 |
|
197 |
-
|
|
|
198 |
|
199 |
-
|
200 |
-
|
201 |
|
202 |
-
|
|
|
|
|
|
|
|
3 |
library_name: peft
|
4 |
---
|
5 |
|
6 |
+
# Gemma2 Fine-Tuned LoRA Model
|
7 |
|
8 |
+
## Overview
|
9 |
+
This is a **LoRA (Low-Rank Adaptation)** fine-tuned model based on the **`unsloth/gemma-7b-bnb-4bit`** base model. It has been adapted for a **tipification analysis task** similar to the Llama-3.2-3B-Instruct LoRA fine-tuning, where the model classifies text into categories such as **"ESTAFA," "ROBO," "HURTO,"** and their **"TENTATIVA DE"** variations.
|
10 |
|
11 |
+
During fine-tuning, only specific adapter layers were trained (\~50 million parameters), while the rest of the base model was frozen. This approach allows parameter-efficient training, significantly reducing computational costs.
|
12 |
|
13 |
+
---
|
14 |
|
15 |
+
## Key Features
|
16 |
+
- **Base Model**: `unsloth/gemma-7b-bnb-4bit`
|
17 |
+
- **Task Type**: Causal Language Modeling (`CAUSAL_LM`)
|
18 |
+
- **LoRA Parameters**:
|
19 |
+
- `r`: 16
|
20 |
+
- `lora_alpha`: 16
|
21 |
+
- `lora_dropout`: 0.0
|
22 |
+
- **Target Modules**:
|
23 |
+
- `gate_proj`, `up_proj`, `down_proj`, `k_proj`, `q_proj`, `o_proj`, `v_proj`
|
24 |
+
- **Number of Trainable Parameters**: **50,003,968**
|
25 |
+
- **Training Loss & Validation Loss**:
|
26 |
+
- Observed over **117 steps** (1 epoch).
|
27 |
+
- See table below for detailed step-by-step values.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
+
---
|
30 |
|
31 |
+
## Dataset Distribution
|
32 |
+
This model was fine-tuned on the **same dataset** as the Llama-3.2-3B-Instruct LoRA version, with the following category distribution:
|
33 |
|
34 |
+
| **Category** | **Count** | **Percentage** |
|
35 |
+
|--------------------------|-----------|----------------|
|
36 |
+
| ESTAFA | 4610 | 47.3% |
|
37 |
+
| ROBO | 2307 | 23.7% |
|
38 |
+
| HURTO | 2141 | 22.0% |
|
39 |
+
| TENTATIVA DE ESTAFA | 306 | 3.1% |
|
40 |
+
| TENTATIVA DE ROBO | 272 | 2.8% |
|
41 |
+
| TENTATIVA DE HURTO | 113 | 1.2% |
|
42 |
+
| **Total** | 9749 | 100% |
|
43 |
|
44 |
+
Although the dataset has nearly 10K examples in this summary table, the fine-tuning run used an extended version (\~15K examples) for this particular training session.
|
45 |
|
46 |
+
---
|
47 |
|
48 |
## Training Details
|
49 |
+
- **Hardware**: Single GPU A100 40Gb
|
50 |
+
- **Num Examples**: ~15,000
|
51 |
+
- **Epochs**: 1
|
52 |
+
- **Batch Size per Device**: 32
|
53 |
+
- **Gradient Accumulation Steps**: 4
|
54 |
+
- **Effective Total Batch Size**: 128
|
55 |
+
- **Total Steps**: 117
|
56 |
+
- **Number of Trainable Parameters**: 50,003,968
|
57 |
+
|
58 |
+
### Training and Validation Loss
|
59 |
+
Below is a snapshot of how training and validation loss evolved during the single epoch (117 steps):
|
60 |
+
|
61 |
+
| **Step** | **Training Loss** | **Validation Loss** |
|
62 |
+
|----------|-------------------|---------------------|
|
63 |
+
| 10 | 2.974900 | 4.242294 |
|
64 |
+
| 20 | 5.451000 | 4.526450 |
|
65 |
+
| 30 | 4.150400 | 3.632928 |
|
66 |
+
| 40 | 3.036100 | 2.615031 |
|
67 |
+
| 50 | 2.492900 | 2.178700 |
|
68 |
+
| 60 | 2.095400 | 1.886430 |
|
69 |
+
| 70 | 2.099200 | 1.548187 |
|
70 |
+
| 80 | 1.983100 | 2.104600 |
|
71 |
+
| 90 | 2.020900 | 1.526225 |
|
72 |
+
| 100 | 1.727700 | 1.699223 |
|
73 |
+
| 110 | 1.868300 | 1.716561 |
|
74 |
+
| ... | ... | ... |
|
75 |
+
|
76 |
+
Final training concluded at **step 117**.
|
77 |
+
We observe a steady decrease in both training and validation losses, indicating the model was converging throughout the single epoch.
|
78 |
|
79 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
+
## Deployment Instructions
|
82 |
+
You can use this LoRA fine-tuned model with the Hugging Face Transformers library. Below is an example of how to load and run the model for text generation or classification-like tasks:
|
83 |
|
84 |
+
```python
|
85 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
86 |
|
87 |
+
tokenizer = AutoTokenizer.from_pretrained("Petermoyano/unsloth-gemma-7b-bnb-4bit-LoRA-Tipification-CausalLM-16R-16Alpha-1Epoch")
|
88 |
+
model = AutoModelForCausalLM.from_pretrained("Petermoyano/unsloth-gemma-7b-bnb-4bit-LoRA-Tipification-CausalLM-16R-16Alpha-1Epoch")
|
89 |
|
90 |
+
input_text = "TENTATIVA DE ESTAFA:"
|
91 |
+
inputs = tokenizer(input_text, return_tensors="pt")
|
92 |
+
outputs = model.generate(**inputs, max_length=50)
|
93 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|