niksyromyatnikov commited on
Commit
bcbe2fc
·
verified ·
1 Parent(s): 0fce20d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +66 -119
README.md CHANGED
@@ -4,19 +4,22 @@ 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 correct answer letter:
16
 
17
  ```
18
  <bos><start_of_turn>user
19
- Дайте розгорнуту відповідь на завдання, починаючи з ключового слова "Відповідь:" та використовуючи лише наведені нижче варіанти.
20
 
21
  Завдання: З’ясуйте, якими частинами мови є виділені слова в реченні (цифра позначає наступне слово).
22
  Сучасна людина, щоб бути (1)успішною, має вчитися (2)впродовж (3)усього життя, (4)опановуючи нові галузі знань.
@@ -28,11 +31,41 @@ PEFT 4bit tuning of `google/gemma-2-9b-it` on Ukrainian language and literature
28
  Г – форма дієслова (дієприслівник)
29
  Д – прийменник<end_of_turn>
30
  <start_of_turn>model
31
- Відповідь:
32
- 1 - В
33
- 2 - Д
34
- 3 - А
35
- 4 - Г<end_of_turn>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  ```
37
 
38
 
@@ -42,188 +75,102 @@ PEFT 4bit tuning of `google/gemma-2-9b-it` on Ukrainian language and literature
42
 
43
  <!-- Provide a longer summary of what this model is. -->
44
 
45
-
46
-
47
- - **Developed by:** [More Information Needed]
48
- - **Funded by [optional]:** [More Information Needed]
49
- - **Shared by [optional]:** [More Information Needed]
50
- - **Model type:** [More Information Needed]
51
- - **Language(s) (NLP):** [More Information Needed]
52
- - **License:** [More Information Needed]
53
- - **Finetuned from model [optional]:** [More Information Needed]
54
 
55
  ### Model Sources [optional]
56
 
57
  <!-- Provide the basic links for the model. -->
58
 
59
- - **Repository:** [More Information Needed]
60
- - **Paper [optional]:** [More Information Needed]
61
- - **Demo [optional]:** [More Information Needed]
62
 
63
  ## Uses
64
 
65
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
66
-
67
  ### Direct Use
68
 
69
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
70
 
71
- [More Information Needed]
72
-
73
- ### Downstream Use [optional]
74
 
75
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
76
-
77
- [More Information Needed]
78
 
79
  ### Out-of-Scope Use
80
 
81
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
82
-
83
- [More Information Needed]
84
 
85
  ## Bias, Risks, and Limitations
86
 
87
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
88
-
89
- [More Information Needed]
90
 
91
  ### Recommendations
92
 
93
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
94
-
95
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
96
-
97
- ## How to Get Started with the Model
98
-
99
- Use the code below to get started with the model.
100
-
101
- [More Information Needed]
102
 
103
  ## Training Details
104
 
105
  ### Training Data
106
 
107
- <!-- 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. -->
108
-
109
- [More Information Needed]
110
 
111
  ### Training Procedure
112
 
113
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
114
-
115
- #### Preprocessing [optional]
116
-
117
  [More Information Needed]
118
 
119
-
120
  #### Training Hyperparameters
121
 
122
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
123
 
124
- #### Speeds, Sizes, Times [optional]
125
-
126
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
127
 
128
  [More Information Needed]
129
 
130
  ## Evaluation
131
 
132
- <!-- This section describes the evaluation protocols and provides the results. -->
133
-
134
  ### Testing Data, Factors & Metrics
135
 
136
  #### Testing Data
137
 
138
- <!-- This should link to a Dataset Card if possible. -->
139
-
140
- [More Information Needed]
141
 
142
  #### Factors
143
 
144
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
145
-
146
  [More Information Needed]
147
 
148
  #### Metrics
149
 
150
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
151
-
152
  [More Information Needed]
153
 
154
  ### Results
155
 
156
- [More Information Needed]
157
-
158
  #### Summary
159
 
160
-
161
-
162
- ## Model Examination [optional]
163
-
164
- <!-- Relevant interpretability work for the model goes here -->
165
-
166
- [More Information Needed]
167
-
168
- ## Environmental Impact
169
-
170
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
171
-
172
- 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).
173
-
174
- - **Hardware Type:** [More Information Needed]
175
- - **Hours used:** [More Information Needed]
176
- - **Cloud Provider:** [More Information Needed]
177
- - **Compute Region:** [More Information Needed]
178
- - **Carbon Emitted:** [More Information Needed]
179
-
180
- ## Technical Specifications [optional]
181
-
182
- ### Model Architecture and Objective
183
-
184
- [More Information Needed]
185
-
186
- ### Compute Infrastructure
187
-
188
- [More Information Needed]
189
-
190
- #### Hardware
191
-
192
  [More Information Needed]
193
 
194
- #### Software
195
-
196
- [More Information Needed]
197
-
198
- ## Citation [optional]
199
-
200
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
201
 
202
  **BibTeX:**
203
 
204
- [More Information Needed]
 
 
 
 
 
 
 
205
 
206
  **APA:**
207
 
208
  [More Information Needed]
209
 
210
- ## Glossary [optional]
211
-
212
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
213
-
214
- [More Information Needed]
215
-
216
- ## More Information [optional]
217
-
218
- [More Information Needed]
219
-
220
- ## Model Card Authors [optional]
221
-
222
- [More Information Needed]
223
-
224
  ## Model Card Contact
225
 
226
  [More Information Needed]
 
227
  ### Framework versions
228
 
229
  - 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 correct answer letter:
19
 
20
  ```
21
  <bos><start_of_turn>user
22
+ Дайте відповідь на завдання, починаючи з ключового слова "Відповідь:" та використовуючи лише наведені нижче варіанти. У якості відповіді наведіть лише літеру, що відповідає правильному варіанту. Якщо правильних відповідей декілька, то перерахуйте їх через ";".
23
 
24
  Завдання: З’ясуйте, якими частинами мови є виділені слова в реченні (цифра позначає наступне слово).
25
  Сучасна людина, щоб бути (1)успішною, має вчитися (2)впродовж (3)усього життя, (4)опановуючи нові галузі знань.
 
31
  Г – форма дієслова (дієприслівник)
32
  Д – прийменник<end_of_turn>
33
  <start_of_turn>model
34
+ Відповідь: В;Д;А;Б<end_of_turn>
35
+ ```
36
+
37
+
38
+ ## Inference code
39
+
40
+ ```
41
+ import torch
42
+ from peft import PeftModel
43
+ from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
44
+
45
+ quantization_config = BitsAndBytesConfig(
46
+ load_in_4bit=True,
47
+ bnb_4bit_compute_dtype=torch.float16, # computation in fp16
48
+ bnb_4bit_use_double_quant=True, # enables double quantization for better accuracy
49
+ bnb_4bit_quant_type="nf4" # choose "nf4" (normal float4) or other types as supported
50
+ )
51
+
52
+ base_model = "google/gemma-2-9b-it"
53
+
54
+ tokenizer = AutoTokenizer.from_pretrained(base_model, max_sequence_length=3072, model_max_length=3072)
55
+ model_base = AutoModelForCausalLM.from_pretrained(base_model, quantization_config=quantization_config, device_map="auto", torch_dtype=torch.float16, use_flash_attention_2=False)
56
+ model = PeftModel.from_pretrained(model_base, "NLPForUA/gemma-2-it-zno-al", quantization_config=quantization_config, device_map="auto", torch_dtype=torch.float16, use_flash_attention_2=False)
57
+
58
+ print(tokenizer.decode(
59
+ model.generate(
60
+ input_ids=inputs,
61
+ max_new_tokens=1024,
62
+ use_cache=True,
63
+ temperature=0.0,
64
+ do_sample=False,
65
+ repetition_penalty=1.0,
66
+ pad_token_id=tokenizer.eos_token_id,
67
+ eos_token_id=[101, 107]
68
+ )[0]))
69
  ```
70
 
71
 
 
75
 
76
  <!-- Provide a longer summary of what this model is. -->
77
 
78
+ - **Developed by:** NLP for UA
79
+ - **Model type:** Gemma
80
+ - **Language(s) (NLP):** Ukrainian (uk)
81
+ - **License:** cc-by-nc-4.0
82
+ - **Finetuned from model:** google/gemma-2-9b-it
 
 
 
 
83
 
84
  ### Model Sources [optional]
85
 
86
  <!-- Provide the basic links for the model. -->
87
 
88
+ - **Repository:** [github.com/NLPForUA/ZNO](https://github.com/NLPForUA/ZNO)
89
+ - **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)
 
90
 
91
  ## Uses
92
 
 
 
93
  ### Direct Use
94
 
95
+ The model can be used directly for generating correct answers to Ukrainian language and literature exam tasks. Input should follow the format shown in the example above.
96
 
97
+ ### Downstream Use
 
 
98
 
99
+ The model could be fine-tuned further for other Ukrainian language tasks or integrated into educational applications.
 
 
100
 
101
  ### Out-of-Scope Use
102
 
103
+ This model is specifically trained for Ukrainian exam tasks. It may not perform well on other languages or tasks.
 
 
104
 
105
  ## Bias, Risks, and Limitations
106
 
107
+ 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.
 
 
108
 
109
  ### Recommendations
110
 
111
+ 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.
 
 
 
 
 
 
 
 
112
 
113
  ## Training Details
114
 
115
  ### Training Data
116
 
117
+ [More Information Needed - Link to Dataset Card and description]
 
 
118
 
119
  ### Training Procedure
120
 
 
 
 
 
121
  [More Information Needed]
122
 
 
123
  #### Training Hyperparameters
124
 
125
+ - **Training regime:** 4-bit quantization
126
 
127
+ #### Speeds, Sizes, Times
 
 
128
 
129
  [More Information Needed]
130
 
131
  ## Evaluation
132
 
 
 
133
  ### Testing Data, Factors & Metrics
134
 
135
  #### Testing Data
136
 
137
+ [More Information Needed - Link to Dataset Card and description]
 
 
138
 
139
  #### Factors
140
 
 
 
141
  [More Information Needed]
142
 
143
  #### Metrics
144
 
 
 
145
  [More Information Needed]
146
 
147
  ### Results
148
 
 
 
149
  #### Summary
150
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  [More Information Needed]
152
 
153
+ ## Citation
 
 
 
 
 
 
154
 
155
  **BibTeX:**
156
 
157
+ ```bibtex
158
+ @article{EmpoweringSmallerModels,
159
+ author = {Mykyta Syromiatnikov, Victoria Ruvinskaya, and Nataliia Komleva},
160
+ title = {Empowering Smaller Models: Tuning LLaMA and Gemma with Chain-of-Thought for Ukrainian Exam Tasks},
161
+ journal = {arXiv preprint arXiv:2503.13988},
162
+ year = {2025}
163
+ }
164
+ ```
165
 
166
  **APA:**
167
 
168
  [More Information Needed]
169
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  ## Model Card Contact
171
 
172
  [More Information Needed]
173
+
174
  ### Framework versions
175
 
176
  - PEFT 0.14.0