niksyromyatnikov commited on
Commit
e73735f
·
verified ·
1 Parent(s): 4ea644b

Update README.md

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