Update README.md
Browse files
README.md
CHANGED
@@ -4,12 +4,15 @@ library_name: peft
|
|
4 |
license: cc-by-nc-4.0
|
5 |
language:
|
6 |
- uk
|
|
|
7 |
---
|
8 |
|
9 |
# Model Card for Model ID
|
10 |
|
11 |
<!-- Provide a quick summary of what the model is/does. -->
|
12 |
|
|
|
|
|
13 |
Presented in [Empowering Smaller Models: Tuning LLaMA and Gemma with Chain-of-Thought for Ukrainian Exam Tasks (arXiv:2503.13988)](https://arxiv.org/abs/2503.13988)
|
14 |
|
15 |
PEFT 4bit tuning of `google/gemma-2-9b-it` on Ukrainian language and literature tasks of ZNO (EIE) & NMT dataset to generate step-by-step solution:
|
@@ -39,194 +42,142 @@ PEFT 4bit tuning of `google/gemma-2-9b-it` on Ukrainian language and literature
|
|
39 |
```
|
40 |
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
## Model Details
|
43 |
|
44 |
### Model Description
|
45 |
|
46 |
<!-- Provide a longer summary of what this model is. -->
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
- **
|
51 |
-
- **
|
52 |
-
- **
|
53 |
-
- **Model type:** [More Information Needed]
|
54 |
-
- **Language(s) (NLP):** [More Information Needed]
|
55 |
-
- **License:** [More Information Needed]
|
56 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
57 |
|
58 |
### Model Sources [optional]
|
59 |
|
60 |
<!-- Provide the basic links for the model. -->
|
61 |
|
62 |
-
- **Repository:** [
|
63 |
-
- **Paper
|
64 |
-
- **Demo [optional]:** [More Information Needed]
|
65 |
|
66 |
## Uses
|
67 |
|
68 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
69 |
-
|
70 |
### Direct Use
|
71 |
|
72 |
-
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
### Downstream Use [optional]
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
[More Information Needed]
|
81 |
|
82 |
### Out-of-Scope Use
|
83 |
|
84 |
-
|
85 |
-
|
86 |
-
[More Information Needed]
|
87 |
|
88 |
## Bias, Risks, and Limitations
|
89 |
|
90 |
-
|
91 |
-
|
92 |
-
[More Information Needed]
|
93 |
|
94 |
### Recommendations
|
95 |
|
96 |
-
|
97 |
-
|
98 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
99 |
-
|
100 |
-
## How to Get Started with the Model
|
101 |
-
|
102 |
-
Use the code below to get started with the model.
|
103 |
-
|
104 |
-
[More Information Needed]
|
105 |
|
106 |
## Training Details
|
107 |
|
108 |
### Training Data
|
109 |
|
110 |
-
|
111 |
-
|
112 |
-
[More Information Needed]
|
113 |
|
114 |
### Training Procedure
|
115 |
|
116 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
117 |
-
|
118 |
-
#### Preprocessing [optional]
|
119 |
-
|
120 |
[More Information Needed]
|
121 |
|
122 |
-
|
123 |
#### Training Hyperparameters
|
124 |
|
125 |
-
- **Training regime:**
|
126 |
|
127 |
-
#### Speeds, Sizes, Times
|
128 |
-
|
129 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
130 |
|
131 |
[More Information Needed]
|
132 |
|
133 |
## Evaluation
|
134 |
|
135 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
136 |
-
|
137 |
### Testing Data, Factors & Metrics
|
138 |
|
139 |
#### Testing Data
|
140 |
|
141 |
-
|
142 |
-
|
143 |
-
[More Information Needed]
|
144 |
|
145 |
#### Factors
|
146 |
|
147 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
148 |
-
|
149 |
[More Information Needed]
|
150 |
|
151 |
#### Metrics
|
152 |
|
153 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
154 |
-
|
155 |
[More Information Needed]
|
156 |
|
157 |
### Results
|
158 |
|
159 |
-
[More Information Needed]
|
160 |
-
|
161 |
#### Summary
|
162 |
|
163 |
-
|
164 |
-
|
165 |
-
## Model Examination [optional]
|
166 |
-
|
167 |
-
<!-- Relevant interpretability work for the model goes here -->
|
168 |
-
|
169 |
-
[More Information Needed]
|
170 |
-
|
171 |
-
## Environmental Impact
|
172 |
-
|
173 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
174 |
-
|
175 |
-
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).
|
176 |
-
|
177 |
-
- **Hardware Type:** [More Information Needed]
|
178 |
-
- **Hours used:** [More Information Needed]
|
179 |
-
- **Cloud Provider:** [More Information Needed]
|
180 |
-
- **Compute Region:** [More Information Needed]
|
181 |
-
- **Carbon Emitted:** [More Information Needed]
|
182 |
-
|
183 |
-
## Technical Specifications [optional]
|
184 |
-
|
185 |
-
### Model Architecture and Objective
|
186 |
-
|
187 |
-
[More Information Needed]
|
188 |
-
|
189 |
-
### Compute Infrastructure
|
190 |
-
|
191 |
-
[More Information Needed]
|
192 |
-
|
193 |
-
#### Hardware
|
194 |
-
|
195 |
[More Information Needed]
|
196 |
|
197 |
-
|
198 |
-
|
199 |
-
[More Information Needed]
|
200 |
-
|
201 |
-
## Citation [optional]
|
202 |
-
|
203 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
204 |
|
205 |
**BibTeX:**
|
206 |
|
207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
|
209 |
**APA:**
|
210 |
|
211 |
[More Information Needed]
|
212 |
|
213 |
-
## Glossary [optional]
|
214 |
-
|
215 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
216 |
-
|
217 |
-
[More Information Needed]
|
218 |
-
|
219 |
-
## More Information [optional]
|
220 |
-
|
221 |
-
[More Information Needed]
|
222 |
-
|
223 |
-
## Model Card Authors [optional]
|
224 |
-
|
225 |
-
[More Information Needed]
|
226 |
-
|
227 |
## Model Card Contact
|
228 |
|
229 |
[More Information Needed]
|
|
|
230 |
### Framework versions
|
231 |
|
232 |
- PEFT 0.14.0
|
|
|
4 |
license: cc-by-nc-4.0
|
5 |
language:
|
6 |
- uk
|
7 |
+
pipeline_tag: text-generation
|
8 |
---
|
9 |
|
10 |
# Model Card for Model ID
|
11 |
|
12 |
<!-- Provide a quick summary of what the model is/does. -->
|
13 |
|
14 |
+
**This model is CC BY NC 4.0 (allowing only non-commercial use) and should not be used outside of research purposes.**
|
15 |
+
|
16 |
Presented in [Empowering Smaller Models: Tuning LLaMA and Gemma with Chain-of-Thought for Ukrainian Exam Tasks (arXiv:2503.13988)](https://arxiv.org/abs/2503.13988)
|
17 |
|
18 |
PEFT 4bit tuning of `google/gemma-2-9b-it` on Ukrainian language and literature tasks of ZNO (EIE) & NMT dataset to generate step-by-step solution:
|
|
|
42 |
```
|
43 |
|
44 |
|
45 |
+
## Inference code
|
46 |
+
|
47 |
+
```
|
48 |
+
import torch
|
49 |
+
from peft import PeftModel
|
50 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
|
51 |
+
|
52 |
+
quantization_config = BitsAndBytesConfig(
|
53 |
+
load_in_4bit=True,
|
54 |
+
bnb_4bit_compute_dtype=torch.float16, # computation in fp16
|
55 |
+
bnb_4bit_use_double_quant=True, # enables double quantization for better accuracy
|
56 |
+
bnb_4bit_quant_type="nf4" # choose "nf4" (normal float4) or other types as supported
|
57 |
+
)
|
58 |
+
|
59 |
+
base_model = "google/gemma-2-9b-it"
|
60 |
+
|
61 |
+
tokenizer = AutoTokenizer.from_pretrained(base_model, max_sequence_length=3072, model_max_length=3072)
|
62 |
+
model_base = AutoModelForCausalLM.from_pretrained(base_model, quantization_config=quantization_config, device_map="auto", torch_dtype=torch.float16, use_flash_attention_2=False)
|
63 |
+
model = PeftModel.from_pretrained(model_base, "NLPForUA/gemma-2-it-zno-cot", quantization_config=quantization_config, device_map="auto", torch_dtype=torch.float16, use_flash_attention_2=False)
|
64 |
+
|
65 |
+
print(tokenizer.decode(
|
66 |
+
model.generate(
|
67 |
+
input_ids=inputs,
|
68 |
+
max_new_tokens=1024,
|
69 |
+
use_cache=True,
|
70 |
+
temperature=0.0,
|
71 |
+
do_sample=False,
|
72 |
+
repetition_penalty=1.0,
|
73 |
+
pad_token_id=tokenizer.eos_token_id,
|
74 |
+
eos_token_id=[101, 107]
|
75 |
+
)[0]))
|
76 |
+
```
|
77 |
+
|
78 |
+
|
79 |
## Model Details
|
80 |
|
81 |
### Model Description
|
82 |
|
83 |
<!-- Provide a longer summary of what this model is. -->
|
84 |
|
85 |
+
- **Developed by:** NLP for UA
|
86 |
+
- **Model type:** Gemma
|
87 |
+
- **Language(s) (NLP):** Ukrainian (uk)
|
88 |
+
- **License:** cc-by-nc-4.0
|
89 |
+
- **Finetuned from model:** google/gemma-2-9b-it
|
|
|
|
|
|
|
|
|
90 |
|
91 |
### Model Sources [optional]
|
92 |
|
93 |
<!-- Provide the basic links for the model. -->
|
94 |
|
95 |
+
- **Repository:** [github.com/NLPForUA/ZNO](https://github.com/NLPForUA/ZNO)
|
96 |
+
- **Paper:** [Empowering Smaller Models: Tuning LLaMA and Gemma with Chain-of-Thought for Ukrainian Exam Tasks (arXiv:2503.13988)](https://arxiv.org/abs/2503.13988)
|
|
|
97 |
|
98 |
## Uses
|
99 |
|
|
|
|
|
100 |
### Direct Use
|
101 |
|
102 |
+
The model can be used directly for generating step-by-step solutions to Ukrainian language and literature exam tasks. Input should follow the format shown in the example above.
|
103 |
|
104 |
+
### Downstream Use
|
|
|
|
|
105 |
|
106 |
+
The model could be fine-tuned further for other Ukrainian language tasks or integrated into educational applications.
|
|
|
|
|
107 |
|
108 |
### Out-of-Scope Use
|
109 |
|
110 |
+
This model is specifically trained for Ukrainian exam tasks. It may not perform well on other languages or tasks.
|
|
|
|
|
111 |
|
112 |
## Bias, Risks, and Limitations
|
113 |
|
114 |
+
The model may exhibit biases present in the training data. It is crucial to critically evaluate its outputs and be aware of potential inaccuracies. Further analysis is needed to fully characterize biases and limitations.
|
|
|
|
|
115 |
|
116 |
### Recommendations
|
117 |
|
118 |
+
Users should be aware of the potential biases and limitations of the model and use its output critically. Further evaluation is needed to fully assess the model's capabilities and limitations.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
## Training Details
|
121 |
|
122 |
### Training Data
|
123 |
|
124 |
+
[More Information Needed - Link to Dataset Card and description]
|
|
|
|
|
125 |
|
126 |
### Training Procedure
|
127 |
|
|
|
|
|
|
|
|
|
128 |
[More Information Needed]
|
129 |
|
|
|
130 |
#### Training Hyperparameters
|
131 |
|
132 |
+
- **Training regime:** 4-bit quantization
|
133 |
|
134 |
+
#### Speeds, Sizes, Times
|
|
|
|
|
135 |
|
136 |
[More Information Needed]
|
137 |
|
138 |
## Evaluation
|
139 |
|
|
|
|
|
140 |
### Testing Data, Factors & Metrics
|
141 |
|
142 |
#### Testing Data
|
143 |
|
144 |
+
[More Information Needed - Link to Dataset Card and description]
|
|
|
|
|
145 |
|
146 |
#### Factors
|
147 |
|
|
|
|
|
148 |
[More Information Needed]
|
149 |
|
150 |
#### Metrics
|
151 |
|
|
|
|
|
152 |
[More Information Needed]
|
153 |
|
154 |
### Results
|
155 |
|
|
|
|
|
156 |
#### Summary
|
157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
[More Information Needed]
|
159 |
|
160 |
+
## Citation
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
|
162 |
**BibTeX:**
|
163 |
|
164 |
+
```bibtex
|
165 |
+
@article{EmpoweringSmallerModels,
|
166 |
+
author = {Mykyta Syromiatnikov, Victoria Ruvinskaya, and Nataliia Komleva},
|
167 |
+
title = {Empowering Smaller Models: Tuning LLaMA and Gemma with Chain-of-Thought for Ukrainian Exam Tasks},
|
168 |
+
journal = {arXiv preprint arXiv:2503.13988},
|
169 |
+
year = {2025}
|
170 |
+
}
|
171 |
+
```
|
172 |
|
173 |
**APA:**
|
174 |
|
175 |
[More Information Needed]
|
176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
## Model Card Contact
|
178 |
|
179 |
[More Information Needed]
|
180 |
+
|
181 |
### Framework versions
|
182 |
|
183 |
- PEFT 0.14.0
|