First successful fine-tuning run, resulting model is no good but it does train successfully
Browse files- fine-tuned-model/checkpoint-236/README.md +202 -0
- fine-tuned-model/checkpoint-236/adapter_config.json +36 -0
- fine-tuned-model/checkpoint-236/adapter_model.safetensors +3 -0
- fine-tuned-model/checkpoint-236/optimizer.pt +3 -0
- fine-tuned-model/checkpoint-236/rng_state.pth +3 -0
- fine-tuned-model/checkpoint-236/scaler.pt +3 -0
- fine-tuned-model/checkpoint-236/scheduler.pt +3 -0
- fine-tuned-model/checkpoint-236/special_tokens_map.json +23 -0
- fine-tuned-model/checkpoint-236/tokenizer.json +0 -0
- fine-tuned-model/checkpoint-236/tokenizer_config.json +195 -0
- fine-tuned-model/checkpoint-236/trainer_state.json +78 -0
- fine-tuned-model/checkpoint-236/training_args.bin +3 -0
- fine-tuned-model/checkpoint-354/README.md +202 -0
- fine-tuned-model/checkpoint-354/adapter_config.json +36 -0
- fine-tuned-model/checkpoint-354/adapter_model.safetensors +3 -0
- fine-tuned-model/checkpoint-354/optimizer.pt +3 -0
- fine-tuned-model/checkpoint-354/rng_state.pth +3 -0
- fine-tuned-model/checkpoint-354/scaler.pt +3 -0
- fine-tuned-model/checkpoint-354/scheduler.pt +3 -0
- fine-tuned-model/checkpoint-354/special_tokens_map.json +23 -0
- fine-tuned-model/checkpoint-354/tokenizer.json +0 -0
- fine-tuned-model/checkpoint-354/tokenizer_config.json +195 -0
- fine-tuned-model/checkpoint-354/trainer_state.json +107 -0
- fine-tuned-model/checkpoint-354/training_args.bin +3 -0
- fine-tuned-model/config.json +48 -0
- fine-tuned-model/generation_config.json +7 -0
- fine-tuned-model/model.safetensors +3 -0
- fine-tuned-model/runs/Apr03_12-18-26_DESKTOP-SMJC97K/events.out.tfevents.1743707907.DESKTOP-SMJC97K.10280.0 +3 -0
- fine-tuned-model/special_tokens_map.json +23 -0
- fine-tuned-model/tokenizer.json +0 -0
- fine-tuned-model/tokenizer_config.json +195 -0
- finetune_model.ipynb +255 -188
fine-tuned-model/checkpoint-236/README.md
ADDED
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model: ./deepseek-coder-1.3b-instruct
|
3 |
+
library_name: peft
|
4 |
+
---
|
5 |
+
|
6 |
+
# Model Card for Model ID
|
7 |
+
|
8 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
+
## Model Details
|
13 |
+
|
14 |
+
### Model Description
|
15 |
+
|
16 |
+
<!-- Provide a longer summary of what this model is. -->
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
- **Developed by:** [More Information Needed]
|
21 |
+
- **Funded by [optional]:** [More Information Needed]
|
22 |
+
- **Shared by [optional]:** [More Information Needed]
|
23 |
+
- **Model type:** [More Information Needed]
|
24 |
+
- **Language(s) (NLP):** [More Information Needed]
|
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 |
+
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
67 |
+
|
68 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
69 |
+
|
70 |
+
## How to Get Started with the Model
|
71 |
+
|
72 |
+
Use the code below to get started with the model.
|
73 |
+
|
74 |
+
[More Information Needed]
|
75 |
+
|
76 |
+
## Training Details
|
77 |
+
|
78 |
+
### Training Data
|
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 |
+
[More Information Needed]
|
196 |
+
|
197 |
+
## Model Card Contact
|
198 |
+
|
199 |
+
[More Information Needed]
|
200 |
+
### Framework versions
|
201 |
+
|
202 |
+
- PEFT 0.15.1
|
fine-tuned-model/checkpoint-236/adapter_config.json
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"alpha_pattern": {},
|
3 |
+
"auto_mapping": null,
|
4 |
+
"base_model_name_or_path": "./deepseek-coder-1.3b-instruct",
|
5 |
+
"bias": "none",
|
6 |
+
"corda_config": null,
|
7 |
+
"eva_config": null,
|
8 |
+
"exclude_modules": null,
|
9 |
+
"fan_in_fan_out": false,
|
10 |
+
"inference_mode": true,
|
11 |
+
"init_lora_weights": true,
|
12 |
+
"layer_replication": null,
|
13 |
+
"layers_pattern": null,
|
14 |
+
"layers_to_transform": null,
|
15 |
+
"loftq_config": {},
|
16 |
+
"lora_alpha": 32,
|
17 |
+
"lora_bias": false,
|
18 |
+
"lora_dropout": 0.1,
|
19 |
+
"megatron_config": null,
|
20 |
+
"megatron_core": "megatron.core",
|
21 |
+
"modules_to_save": null,
|
22 |
+
"peft_type": "LORA",
|
23 |
+
"r": 16,
|
24 |
+
"rank_pattern": {},
|
25 |
+
"revision": null,
|
26 |
+
"target_modules": [
|
27 |
+
"q_proj",
|
28 |
+
"k_proj",
|
29 |
+
"v_proj",
|
30 |
+
"o_proj"
|
31 |
+
],
|
32 |
+
"task_type": "CAUSAL_LM",
|
33 |
+
"trainable_token_indices": null,
|
34 |
+
"use_dora": false,
|
35 |
+
"use_rslora": false
|
36 |
+
}
|
fine-tuned-model/checkpoint-236/adapter_model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c1675aadfd9bd5995a73de58148ef251da4d532994321a4944157eb47e23efe1
|
3 |
+
size 25191536
|
fine-tuned-model/checkpoint-236/optimizer.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4154204936127b67041d1fa14b3b47592d28098e3af1fbc90ccb186d4b7aa920
|
3 |
+
size 50492858
|
fine-tuned-model/checkpoint-236/rng_state.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9594002d0ce67a88462882fb88058ad890c8624e05cfe9253cbfdb98dbcea4d7
|
3 |
+
size 14244
|
fine-tuned-model/checkpoint-236/scaler.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:713b6197e1c6fd2587869ada366ebb7d57d251ebefa1a0bc3b17bf2ed26a407b
|
3 |
+
size 988
|
fine-tuned-model/checkpoint-236/scheduler.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:babe16327608a66b40524b5a3c6405ef24c518e11abf91e1eb89f529de80b3db
|
3 |
+
size 1064
|
fine-tuned-model/checkpoint-236/special_tokens_map.json
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": {
|
3 |
+
"content": "<|begin▁of▁sentence|>",
|
4 |
+
"lstrip": false,
|
5 |
+
"normalized": true,
|
6 |
+
"rstrip": false,
|
7 |
+
"single_word": false
|
8 |
+
},
|
9 |
+
"eos_token": {
|
10 |
+
"content": "<|EOT|>",
|
11 |
+
"lstrip": false,
|
12 |
+
"normalized": true,
|
13 |
+
"rstrip": false,
|
14 |
+
"single_word": false
|
15 |
+
},
|
16 |
+
"pad_token": {
|
17 |
+
"content": "<|end▁of▁sentence|>",
|
18 |
+
"lstrip": false,
|
19 |
+
"normalized": true,
|
20 |
+
"rstrip": false,
|
21 |
+
"single_word": false
|
22 |
+
}
|
23 |
+
}
|
fine-tuned-model/checkpoint-236/tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
fine-tuned-model/checkpoint-236/tokenizer_config.json
ADDED
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_bos_token": true,
|
3 |
+
"add_eos_token": false,
|
4 |
+
"add_prefix_space": null,
|
5 |
+
"added_tokens_decoder": {
|
6 |
+
"32000": {
|
7 |
+
"content": "õ",
|
8 |
+
"lstrip": false,
|
9 |
+
"normalized": true,
|
10 |
+
"rstrip": false,
|
11 |
+
"single_word": false,
|
12 |
+
"special": false
|
13 |
+
},
|
14 |
+
"32001": {
|
15 |
+
"content": "÷",
|
16 |
+
"lstrip": false,
|
17 |
+
"normalized": true,
|
18 |
+
"rstrip": false,
|
19 |
+
"single_word": false,
|
20 |
+
"special": false
|
21 |
+
},
|
22 |
+
"32002": {
|
23 |
+
"content": "Á",
|
24 |
+
"lstrip": false,
|
25 |
+
"normalized": true,
|
26 |
+
"rstrip": false,
|
27 |
+
"single_word": false,
|
28 |
+
"special": false
|
29 |
+
},
|
30 |
+
"32003": {
|
31 |
+
"content": "ý",
|
32 |
+
"lstrip": false,
|
33 |
+
"normalized": true,
|
34 |
+
"rstrip": false,
|
35 |
+
"single_word": false,
|
36 |
+
"special": false
|
37 |
+
},
|
38 |
+
"32004": {
|
39 |
+
"content": "À",
|
40 |
+
"lstrip": false,
|
41 |
+
"normalized": true,
|
42 |
+
"rstrip": false,
|
43 |
+
"single_word": false,
|
44 |
+
"special": false
|
45 |
+
},
|
46 |
+
"32005": {
|
47 |
+
"content": "ÿ",
|
48 |
+
"lstrip": false,
|
49 |
+
"normalized": true,
|
50 |
+
"rstrip": false,
|
51 |
+
"single_word": false,
|
52 |
+
"special": false
|
53 |
+
},
|
54 |
+
"32006": {
|
55 |
+
"content": "ø",
|
56 |
+
"lstrip": false,
|
57 |
+
"normalized": true,
|
58 |
+
"rstrip": false,
|
59 |
+
"single_word": false,
|
60 |
+
"special": false
|
61 |
+
},
|
62 |
+
"32007": {
|
63 |
+
"content": "ú",
|
64 |
+
"lstrip": false,
|
65 |
+
"normalized": true,
|
66 |
+
"rstrip": false,
|
67 |
+
"single_word": false,
|
68 |
+
"special": false
|
69 |
+
},
|
70 |
+
"32008": {
|
71 |
+
"content": "þ",
|
72 |
+
"lstrip": false,
|
73 |
+
"normalized": true,
|
74 |
+
"rstrip": false,
|
75 |
+
"single_word": false,
|
76 |
+
"special": false
|
77 |
+
},
|
78 |
+
"32009": {
|
79 |
+
"content": "ü",
|
80 |
+
"lstrip": false,
|
81 |
+
"normalized": true,
|
82 |
+
"rstrip": false,
|
83 |
+
"single_word": false,
|
84 |
+
"special": false
|
85 |
+
},
|
86 |
+
"32010": {
|
87 |
+
"content": "ù",
|
88 |
+
"lstrip": false,
|
89 |
+
"normalized": true,
|
90 |
+
"rstrip": false,
|
91 |
+
"single_word": false,
|
92 |
+
"special": false
|
93 |
+
},
|
94 |
+
"32011": {
|
95 |
+
"content": "ö",
|
96 |
+
"lstrip": false,
|
97 |
+
"normalized": true,
|
98 |
+
"rstrip": false,
|
99 |
+
"single_word": false,
|
100 |
+
"special": false
|
101 |
+
},
|
102 |
+
"32012": {
|
103 |
+
"content": "û",
|
104 |
+
"lstrip": false,
|
105 |
+
"normalized": true,
|
106 |
+
"rstrip": false,
|
107 |
+
"single_word": false,
|
108 |
+
"special": false
|
109 |
+
},
|
110 |
+
"32013": {
|
111 |
+
"content": "<|begin▁of▁sentence|>",
|
112 |
+
"lstrip": false,
|
113 |
+
"normalized": true,
|
114 |
+
"rstrip": false,
|
115 |
+
"single_word": false,
|
116 |
+
"special": true
|
117 |
+
},
|
118 |
+
"32014": {
|
119 |
+
"content": "<|end▁of▁sentence|>",
|
120 |
+
"lstrip": false,
|
121 |
+
"normalized": true,
|
122 |
+
"rstrip": false,
|
123 |
+
"single_word": false,
|
124 |
+
"special": true
|
125 |
+
},
|
126 |
+
"32015": {
|
127 |
+
"content": "<|fim▁hole|>",
|
128 |
+
"lstrip": false,
|
129 |
+
"normalized": true,
|
130 |
+
"rstrip": false,
|
131 |
+
"single_word": false,
|
132 |
+
"special": false
|
133 |
+
},
|
134 |
+
"32016": {
|
135 |
+
"content": "<|fim▁begin|>",
|
136 |
+
"lstrip": false,
|
137 |
+
"normalized": true,
|
138 |
+
"rstrip": false,
|
139 |
+
"single_word": false,
|
140 |
+
"special": false
|
141 |
+
},
|
142 |
+
"32017": {
|
143 |
+
"content": "<|fim▁end|>",
|
144 |
+
"lstrip": false,
|
145 |
+
"normalized": true,
|
146 |
+
"rstrip": false,
|
147 |
+
"single_word": false,
|
148 |
+
"special": false
|
149 |
+
},
|
150 |
+
"32018": {
|
151 |
+
"content": "<pad>",
|
152 |
+
"lstrip": false,
|
153 |
+
"normalized": true,
|
154 |
+
"rstrip": false,
|
155 |
+
"single_word": false,
|
156 |
+
"special": false
|
157 |
+
},
|
158 |
+
"32019": {
|
159 |
+
"content": "<|User|>",
|
160 |
+
"lstrip": false,
|
161 |
+
"normalized": true,
|
162 |
+
"rstrip": false,
|
163 |
+
"single_word": false,
|
164 |
+
"special": false
|
165 |
+
},
|
166 |
+
"32020": {
|
167 |
+
"content": "<|Assistant|>",
|
168 |
+
"lstrip": false,
|
169 |
+
"normalized": true,
|
170 |
+
"rstrip": false,
|
171 |
+
"single_word": false,
|
172 |
+
"special": false
|
173 |
+
},
|
174 |
+
"32021": {
|
175 |
+
"content": "<|EOT|>",
|
176 |
+
"lstrip": false,
|
177 |
+
"normalized": true,
|
178 |
+
"rstrip": false,
|
179 |
+
"single_word": false,
|
180 |
+
"special": true
|
181 |
+
}
|
182 |
+
},
|
183 |
+
"bos_token": "<|begin▁of▁sentence|>",
|
184 |
+
"chat_template": "{% if not add_generation_prompt is defined %}\n{% set add_generation_prompt = false %}\n{% endif %}\n{%- set ns = namespace(found=false) -%}\n{%- for message in messages -%}\n {%- if message['role'] == 'system' -%}\n {%- set ns.found = true -%}\n {%- endif -%}\n{%- endfor -%}\n{{bos_token}}{%- if not ns.found -%}\n{{'You are an AI programming assistant, utilizing the Deepseek Coder model, developed by Deepseek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer\\n'}}\n{%- endif %}\n{%- for message in messages %}\n {%- if message['role'] == 'system' %}\n{{ message['content'] }}\n {%- else %}\n {%- if message['role'] == 'user' %}\n{{'### Instruction:\\n' + message['content'] + '\\n'}}\n {%- else %}\n{{'### Response:\\n' + message['content'] + '\\n<|EOT|>\\n'}}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{% if add_generation_prompt %}\n{{'### Response:'}}\n{% endif %}",
|
185 |
+
"clean_up_tokenization_spaces": false,
|
186 |
+
"eos_token": "<|EOT|>",
|
187 |
+
"extra_special_tokens": {},
|
188 |
+
"legacy": true,
|
189 |
+
"model_max_length": 16384,
|
190 |
+
"pad_token": "<|end▁of▁sentence|>",
|
191 |
+
"sp_model_kwargs": {},
|
192 |
+
"tokenizer_class": "LlamaTokenizerFast",
|
193 |
+
"unk_token": null,
|
194 |
+
"use_default_system_prompt": false
|
195 |
+
}
|
fine-tuned-model/checkpoint-236/trainer_state.json
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"best_global_step": null,
|
3 |
+
"best_metric": null,
|
4 |
+
"best_model_checkpoint": null,
|
5 |
+
"epoch": 2.0,
|
6 |
+
"eval_steps": 500,
|
7 |
+
"global_step": 236,
|
8 |
+
"is_hyper_param_search": false,
|
9 |
+
"is_local_process_zero": true,
|
10 |
+
"is_world_process_zero": true,
|
11 |
+
"log_history": [
|
12 |
+
{
|
13 |
+
"epoch": 0.423728813559322,
|
14 |
+
"grad_norm": 1.3252296447753906,
|
15 |
+
"learning_rate": 0.0004307909604519774,
|
16 |
+
"loss": 3.0243,
|
17 |
+
"step": 50
|
18 |
+
},
|
19 |
+
{
|
20 |
+
"epoch": 0.847457627118644,
|
21 |
+
"grad_norm": 1.302614450454712,
|
22 |
+
"learning_rate": 0.00036016949152542374,
|
23 |
+
"loss": 1.2356,
|
24 |
+
"step": 100
|
25 |
+
},
|
26 |
+
{
|
27 |
+
"epoch": 1.0,
|
28 |
+
"eval_loss": 0.9709166288375854,
|
29 |
+
"eval_runtime": 5.194,
|
30 |
+
"eval_samples_per_second": 20.216,
|
31 |
+
"eval_steps_per_second": 2.695,
|
32 |
+
"step": 118
|
33 |
+
},
|
34 |
+
{
|
35 |
+
"epoch": 1.271186440677966,
|
36 |
+
"grad_norm": 0.6076271533966064,
|
37 |
+
"learning_rate": 0.0002895480225988701,
|
38 |
+
"loss": 1.2005,
|
39 |
+
"step": 150
|
40 |
+
},
|
41 |
+
{
|
42 |
+
"epoch": 1.694915254237288,
|
43 |
+
"grad_norm": 1.1516226530075073,
|
44 |
+
"learning_rate": 0.0002189265536723164,
|
45 |
+
"loss": 1.2331,
|
46 |
+
"step": 200
|
47 |
+
},
|
48 |
+
{
|
49 |
+
"epoch": 2.0,
|
50 |
+
"eval_loss": 0.9370157718658447,
|
51 |
+
"eval_runtime": 5.1425,
|
52 |
+
"eval_samples_per_second": 20.418,
|
53 |
+
"eval_steps_per_second": 2.722,
|
54 |
+
"step": 236
|
55 |
+
}
|
56 |
+
],
|
57 |
+
"logging_steps": 50,
|
58 |
+
"max_steps": 354,
|
59 |
+
"num_input_tokens_seen": 0,
|
60 |
+
"num_train_epochs": 3,
|
61 |
+
"save_steps": 500,
|
62 |
+
"stateful_callbacks": {
|
63 |
+
"TrainerControl": {
|
64 |
+
"args": {
|
65 |
+
"should_epoch_stop": false,
|
66 |
+
"should_evaluate": false,
|
67 |
+
"should_log": false,
|
68 |
+
"should_save": true,
|
69 |
+
"should_training_stop": false
|
70 |
+
},
|
71 |
+
"attributes": {}
|
72 |
+
}
|
73 |
+
},
|
74 |
+
"total_flos": 3711634067423232.0,
|
75 |
+
"train_batch_size": 8,
|
76 |
+
"trial_name": null,
|
77 |
+
"trial_params": null
|
78 |
+
}
|
fine-tuned-model/checkpoint-236/training_args.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:067bd988483e44c78bdd5214e17314d730fc21ddb68a86665b5964dfa1dff3cf
|
3 |
+
size 5368
|
fine-tuned-model/checkpoint-354/README.md
ADDED
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model: ./deepseek-coder-1.3b-instruct
|
3 |
+
library_name: peft
|
4 |
+
---
|
5 |
+
|
6 |
+
# Model Card for Model ID
|
7 |
+
|
8 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
+
## Model Details
|
13 |
+
|
14 |
+
### Model Description
|
15 |
+
|
16 |
+
<!-- Provide a longer summary of what this model is. -->
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
- **Developed by:** [More Information Needed]
|
21 |
+
- **Funded by [optional]:** [More Information Needed]
|
22 |
+
- **Shared by [optional]:** [More Information Needed]
|
23 |
+
- **Model type:** [More Information Needed]
|
24 |
+
- **Language(s) (NLP):** [More Information Needed]
|
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 |
+
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
67 |
+
|
68 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
69 |
+
|
70 |
+
## How to Get Started with the Model
|
71 |
+
|
72 |
+
Use the code below to get started with the model.
|
73 |
+
|
74 |
+
[More Information Needed]
|
75 |
+
|
76 |
+
## Training Details
|
77 |
+
|
78 |
+
### Training Data
|
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 |
+
[More Information Needed]
|
196 |
+
|
197 |
+
## Model Card Contact
|
198 |
+
|
199 |
+
[More Information Needed]
|
200 |
+
### Framework versions
|
201 |
+
|
202 |
+
- PEFT 0.15.1
|
fine-tuned-model/checkpoint-354/adapter_config.json
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"alpha_pattern": {},
|
3 |
+
"auto_mapping": null,
|
4 |
+
"base_model_name_or_path": "./deepseek-coder-1.3b-instruct",
|
5 |
+
"bias": "none",
|
6 |
+
"corda_config": null,
|
7 |
+
"eva_config": null,
|
8 |
+
"exclude_modules": null,
|
9 |
+
"fan_in_fan_out": false,
|
10 |
+
"inference_mode": true,
|
11 |
+
"init_lora_weights": true,
|
12 |
+
"layer_replication": null,
|
13 |
+
"layers_pattern": null,
|
14 |
+
"layers_to_transform": null,
|
15 |
+
"loftq_config": {},
|
16 |
+
"lora_alpha": 32,
|
17 |
+
"lora_bias": false,
|
18 |
+
"lora_dropout": 0.1,
|
19 |
+
"megatron_config": null,
|
20 |
+
"megatron_core": "megatron.core",
|
21 |
+
"modules_to_save": null,
|
22 |
+
"peft_type": "LORA",
|
23 |
+
"r": 16,
|
24 |
+
"rank_pattern": {},
|
25 |
+
"revision": null,
|
26 |
+
"target_modules": [
|
27 |
+
"q_proj",
|
28 |
+
"k_proj",
|
29 |
+
"v_proj",
|
30 |
+
"o_proj"
|
31 |
+
],
|
32 |
+
"task_type": "CAUSAL_LM",
|
33 |
+
"trainable_token_indices": null,
|
34 |
+
"use_dora": false,
|
35 |
+
"use_rslora": false
|
36 |
+
}
|
fine-tuned-model/checkpoint-354/adapter_model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:920b86465c2818967aa645e7034a6f5566672ba63135dcb7809e893d48e77305
|
3 |
+
size 25191536
|
fine-tuned-model/checkpoint-354/optimizer.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d6cf67b41bdad86d98c95348eccb014252be813c3e3c818332ec110bdd9b7218
|
3 |
+
size 50492858
|
fine-tuned-model/checkpoint-354/rng_state.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:514fdade4a576ea3a449805be1a2440948e08bdd1739bc46dff3651cafdbaa1f
|
3 |
+
size 14244
|
fine-tuned-model/checkpoint-354/scaler.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e7c13b31f5b4095a59f0eede567d0ae212057e5fe2f6b3f1f4be4554781e46a5
|
3 |
+
size 988
|
fine-tuned-model/checkpoint-354/scheduler.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a52d2ab24942c7198df251117ba6eb70c88f4cd280a3f04105f33dacfdbfd3ad
|
3 |
+
size 1064
|
fine-tuned-model/checkpoint-354/special_tokens_map.json
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": {
|
3 |
+
"content": "<|begin▁of▁sentence|>",
|
4 |
+
"lstrip": false,
|
5 |
+
"normalized": true,
|
6 |
+
"rstrip": false,
|
7 |
+
"single_word": false
|
8 |
+
},
|
9 |
+
"eos_token": {
|
10 |
+
"content": "<|EOT|>",
|
11 |
+
"lstrip": false,
|
12 |
+
"normalized": true,
|
13 |
+
"rstrip": false,
|
14 |
+
"single_word": false
|
15 |
+
},
|
16 |
+
"pad_token": {
|
17 |
+
"content": "<|end▁of▁sentence|>",
|
18 |
+
"lstrip": false,
|
19 |
+
"normalized": true,
|
20 |
+
"rstrip": false,
|
21 |
+
"single_word": false
|
22 |
+
}
|
23 |
+
}
|
fine-tuned-model/checkpoint-354/tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
fine-tuned-model/checkpoint-354/tokenizer_config.json
ADDED
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_bos_token": true,
|
3 |
+
"add_eos_token": false,
|
4 |
+
"add_prefix_space": null,
|
5 |
+
"added_tokens_decoder": {
|
6 |
+
"32000": {
|
7 |
+
"content": "õ",
|
8 |
+
"lstrip": false,
|
9 |
+
"normalized": true,
|
10 |
+
"rstrip": false,
|
11 |
+
"single_word": false,
|
12 |
+
"special": false
|
13 |
+
},
|
14 |
+
"32001": {
|
15 |
+
"content": "÷",
|
16 |
+
"lstrip": false,
|
17 |
+
"normalized": true,
|
18 |
+
"rstrip": false,
|
19 |
+
"single_word": false,
|
20 |
+
"special": false
|
21 |
+
},
|
22 |
+
"32002": {
|
23 |
+
"content": "Á",
|
24 |
+
"lstrip": false,
|
25 |
+
"normalized": true,
|
26 |
+
"rstrip": false,
|
27 |
+
"single_word": false,
|
28 |
+
"special": false
|
29 |
+
},
|
30 |
+
"32003": {
|
31 |
+
"content": "ý",
|
32 |
+
"lstrip": false,
|
33 |
+
"normalized": true,
|
34 |
+
"rstrip": false,
|
35 |
+
"single_word": false,
|
36 |
+
"special": false
|
37 |
+
},
|
38 |
+
"32004": {
|
39 |
+
"content": "À",
|
40 |
+
"lstrip": false,
|
41 |
+
"normalized": true,
|
42 |
+
"rstrip": false,
|
43 |
+
"single_word": false,
|
44 |
+
"special": false
|
45 |
+
},
|
46 |
+
"32005": {
|
47 |
+
"content": "ÿ",
|
48 |
+
"lstrip": false,
|
49 |
+
"normalized": true,
|
50 |
+
"rstrip": false,
|
51 |
+
"single_word": false,
|
52 |
+
"special": false
|
53 |
+
},
|
54 |
+
"32006": {
|
55 |
+
"content": "ø",
|
56 |
+
"lstrip": false,
|
57 |
+
"normalized": true,
|
58 |
+
"rstrip": false,
|
59 |
+
"single_word": false,
|
60 |
+
"special": false
|
61 |
+
},
|
62 |
+
"32007": {
|
63 |
+
"content": "ú",
|
64 |
+
"lstrip": false,
|
65 |
+
"normalized": true,
|
66 |
+
"rstrip": false,
|
67 |
+
"single_word": false,
|
68 |
+
"special": false
|
69 |
+
},
|
70 |
+
"32008": {
|
71 |
+
"content": "þ",
|
72 |
+
"lstrip": false,
|
73 |
+
"normalized": true,
|
74 |
+
"rstrip": false,
|
75 |
+
"single_word": false,
|
76 |
+
"special": false
|
77 |
+
},
|
78 |
+
"32009": {
|
79 |
+
"content": "ü",
|
80 |
+
"lstrip": false,
|
81 |
+
"normalized": true,
|
82 |
+
"rstrip": false,
|
83 |
+
"single_word": false,
|
84 |
+
"special": false
|
85 |
+
},
|
86 |
+
"32010": {
|
87 |
+
"content": "ù",
|
88 |
+
"lstrip": false,
|
89 |
+
"normalized": true,
|
90 |
+
"rstrip": false,
|
91 |
+
"single_word": false,
|
92 |
+
"special": false
|
93 |
+
},
|
94 |
+
"32011": {
|
95 |
+
"content": "ö",
|
96 |
+
"lstrip": false,
|
97 |
+
"normalized": true,
|
98 |
+
"rstrip": false,
|
99 |
+
"single_word": false,
|
100 |
+
"special": false
|
101 |
+
},
|
102 |
+
"32012": {
|
103 |
+
"content": "û",
|
104 |
+
"lstrip": false,
|
105 |
+
"normalized": true,
|
106 |
+
"rstrip": false,
|
107 |
+
"single_word": false,
|
108 |
+
"special": false
|
109 |
+
},
|
110 |
+
"32013": {
|
111 |
+
"content": "<|begin▁of▁sentence|>",
|
112 |
+
"lstrip": false,
|
113 |
+
"normalized": true,
|
114 |
+
"rstrip": false,
|
115 |
+
"single_word": false,
|
116 |
+
"special": true
|
117 |
+
},
|
118 |
+
"32014": {
|
119 |
+
"content": "<|end▁of▁sentence|>",
|
120 |
+
"lstrip": false,
|
121 |
+
"normalized": true,
|
122 |
+
"rstrip": false,
|
123 |
+
"single_word": false,
|
124 |
+
"special": true
|
125 |
+
},
|
126 |
+
"32015": {
|
127 |
+
"content": "<|fim▁hole|>",
|
128 |
+
"lstrip": false,
|
129 |
+
"normalized": true,
|
130 |
+
"rstrip": false,
|
131 |
+
"single_word": false,
|
132 |
+
"special": false
|
133 |
+
},
|
134 |
+
"32016": {
|
135 |
+
"content": "<|fim▁begin|>",
|
136 |
+
"lstrip": false,
|
137 |
+
"normalized": true,
|
138 |
+
"rstrip": false,
|
139 |
+
"single_word": false,
|
140 |
+
"special": false
|
141 |
+
},
|
142 |
+
"32017": {
|
143 |
+
"content": "<|fim▁end|>",
|
144 |
+
"lstrip": false,
|
145 |
+
"normalized": true,
|
146 |
+
"rstrip": false,
|
147 |
+
"single_word": false,
|
148 |
+
"special": false
|
149 |
+
},
|
150 |
+
"32018": {
|
151 |
+
"content": "<pad>",
|
152 |
+
"lstrip": false,
|
153 |
+
"normalized": true,
|
154 |
+
"rstrip": false,
|
155 |
+
"single_word": false,
|
156 |
+
"special": false
|
157 |
+
},
|
158 |
+
"32019": {
|
159 |
+
"content": "<|User|>",
|
160 |
+
"lstrip": false,
|
161 |
+
"normalized": true,
|
162 |
+
"rstrip": false,
|
163 |
+
"single_word": false,
|
164 |
+
"special": false
|
165 |
+
},
|
166 |
+
"32020": {
|
167 |
+
"content": "<|Assistant|>",
|
168 |
+
"lstrip": false,
|
169 |
+
"normalized": true,
|
170 |
+
"rstrip": false,
|
171 |
+
"single_word": false,
|
172 |
+
"special": false
|
173 |
+
},
|
174 |
+
"32021": {
|
175 |
+
"content": "<|EOT|>",
|
176 |
+
"lstrip": false,
|
177 |
+
"normalized": true,
|
178 |
+
"rstrip": false,
|
179 |
+
"single_word": false,
|
180 |
+
"special": true
|
181 |
+
}
|
182 |
+
},
|
183 |
+
"bos_token": "<|begin▁of▁sentence|>",
|
184 |
+
"chat_template": "{% if not add_generation_prompt is defined %}\n{% set add_generation_prompt = false %}\n{% endif %}\n{%- set ns = namespace(found=false) -%}\n{%- for message in messages -%}\n {%- if message['role'] == 'system' -%}\n {%- set ns.found = true -%}\n {%- endif -%}\n{%- endfor -%}\n{{bos_token}}{%- if not ns.found -%}\n{{'You are an AI programming assistant, utilizing the Deepseek Coder model, developed by Deepseek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer\\n'}}\n{%- endif %}\n{%- for message in messages %}\n {%- if message['role'] == 'system' %}\n{{ message['content'] }}\n {%- else %}\n {%- if message['role'] == 'user' %}\n{{'### Instruction:\\n' + message['content'] + '\\n'}}\n {%- else %}\n{{'### Response:\\n' + message['content'] + '\\n<|EOT|>\\n'}}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{% if add_generation_prompt %}\n{{'### Response:'}}\n{% endif %}",
|
185 |
+
"clean_up_tokenization_spaces": false,
|
186 |
+
"eos_token": "<|EOT|>",
|
187 |
+
"extra_special_tokens": {},
|
188 |
+
"legacy": true,
|
189 |
+
"model_max_length": 16384,
|
190 |
+
"pad_token": "<|end▁of▁sentence|>",
|
191 |
+
"sp_model_kwargs": {},
|
192 |
+
"tokenizer_class": "LlamaTokenizerFast",
|
193 |
+
"unk_token": null,
|
194 |
+
"use_default_system_prompt": false
|
195 |
+
}
|
fine-tuned-model/checkpoint-354/trainer_state.json
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"best_global_step": null,
|
3 |
+
"best_metric": null,
|
4 |
+
"best_model_checkpoint": null,
|
5 |
+
"epoch": 3.0,
|
6 |
+
"eval_steps": 500,
|
7 |
+
"global_step": 354,
|
8 |
+
"is_hyper_param_search": false,
|
9 |
+
"is_local_process_zero": true,
|
10 |
+
"is_world_process_zero": true,
|
11 |
+
"log_history": [
|
12 |
+
{
|
13 |
+
"epoch": 0.423728813559322,
|
14 |
+
"grad_norm": 1.3252296447753906,
|
15 |
+
"learning_rate": 0.0004307909604519774,
|
16 |
+
"loss": 3.0243,
|
17 |
+
"step": 50
|
18 |
+
},
|
19 |
+
{
|
20 |
+
"epoch": 0.847457627118644,
|
21 |
+
"grad_norm": 1.302614450454712,
|
22 |
+
"learning_rate": 0.00036016949152542374,
|
23 |
+
"loss": 1.2356,
|
24 |
+
"step": 100
|
25 |
+
},
|
26 |
+
{
|
27 |
+
"epoch": 1.0,
|
28 |
+
"eval_loss": 0.9709166288375854,
|
29 |
+
"eval_runtime": 5.194,
|
30 |
+
"eval_samples_per_second": 20.216,
|
31 |
+
"eval_steps_per_second": 2.695,
|
32 |
+
"step": 118
|
33 |
+
},
|
34 |
+
{
|
35 |
+
"epoch": 1.271186440677966,
|
36 |
+
"grad_norm": 0.6076271533966064,
|
37 |
+
"learning_rate": 0.0002895480225988701,
|
38 |
+
"loss": 1.2005,
|
39 |
+
"step": 150
|
40 |
+
},
|
41 |
+
{
|
42 |
+
"epoch": 1.694915254237288,
|
43 |
+
"grad_norm": 1.1516226530075073,
|
44 |
+
"learning_rate": 0.0002189265536723164,
|
45 |
+
"loss": 1.2331,
|
46 |
+
"step": 200
|
47 |
+
},
|
48 |
+
{
|
49 |
+
"epoch": 2.0,
|
50 |
+
"eval_loss": 0.9370157718658447,
|
51 |
+
"eval_runtime": 5.1425,
|
52 |
+
"eval_samples_per_second": 20.418,
|
53 |
+
"eval_steps_per_second": 2.722,
|
54 |
+
"step": 236
|
55 |
+
},
|
56 |
+
{
|
57 |
+
"epoch": 2.1186440677966103,
|
58 |
+
"grad_norm": 0.5812012553215027,
|
59 |
+
"learning_rate": 0.0001483050847457627,
|
60 |
+
"loss": 1.1483,
|
61 |
+
"step": 250
|
62 |
+
},
|
63 |
+
{
|
64 |
+
"epoch": 2.542372881355932,
|
65 |
+
"grad_norm": 2.018043279647827,
|
66 |
+
"learning_rate": 7.768361581920904e-05,
|
67 |
+
"loss": 1.1873,
|
68 |
+
"step": 300
|
69 |
+
},
|
70 |
+
{
|
71 |
+
"epoch": 2.9661016949152543,
|
72 |
+
"grad_norm": 0.5886570811271667,
|
73 |
+
"learning_rate": 7.062146892655367e-06,
|
74 |
+
"loss": 1.1576,
|
75 |
+
"step": 350
|
76 |
+
},
|
77 |
+
{
|
78 |
+
"epoch": 3.0,
|
79 |
+
"eval_loss": 0.9401432871818542,
|
80 |
+
"eval_runtime": 5.1425,
|
81 |
+
"eval_samples_per_second": 20.418,
|
82 |
+
"eval_steps_per_second": 2.722,
|
83 |
+
"step": 354
|
84 |
+
}
|
85 |
+
],
|
86 |
+
"logging_steps": 50,
|
87 |
+
"max_steps": 354,
|
88 |
+
"num_input_tokens_seen": 0,
|
89 |
+
"num_train_epochs": 3,
|
90 |
+
"save_steps": 500,
|
91 |
+
"stateful_callbacks": {
|
92 |
+
"TrainerControl": {
|
93 |
+
"args": {
|
94 |
+
"should_epoch_stop": false,
|
95 |
+
"should_evaluate": false,
|
96 |
+
"should_log": false,
|
97 |
+
"should_save": true,
|
98 |
+
"should_training_stop": true
|
99 |
+
},
|
100 |
+
"attributes": {}
|
101 |
+
}
|
102 |
+
},
|
103 |
+
"total_flos": 5567451101134848.0,
|
104 |
+
"train_batch_size": 8,
|
105 |
+
"trial_name": null,
|
106 |
+
"trial_params": null
|
107 |
+
}
|
fine-tuned-model/checkpoint-354/training_args.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:067bd988483e44c78bdd5214e17314d730fc21ddb68a86665b5964dfa1dff3cf
|
3 |
+
size 5368
|
fine-tuned-model/config.json
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": [
|
3 |
+
"LlamaForCausalLM"
|
4 |
+
],
|
5 |
+
"attention_bias": false,
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"bos_token_id": 32013,
|
8 |
+
"eos_token_id": 32021,
|
9 |
+
"head_dim": 128,
|
10 |
+
"hidden_act": "silu",
|
11 |
+
"hidden_size": 2048,
|
12 |
+
"initializer_range": 0.02,
|
13 |
+
"intermediate_size": 5504,
|
14 |
+
"max_position_embeddings": 16384,
|
15 |
+
"mlp_bias": false,
|
16 |
+
"model_type": "llama",
|
17 |
+
"num_attention_heads": 16,
|
18 |
+
"num_hidden_layers": 24,
|
19 |
+
"num_key_value_heads": 16,
|
20 |
+
"pretraining_tp": 1,
|
21 |
+
"quantization_config": {
|
22 |
+
"_load_in_4bit": false,
|
23 |
+
"_load_in_8bit": true,
|
24 |
+
"bnb_4bit_compute_dtype": "float32",
|
25 |
+
"bnb_4bit_quant_storage": "uint8",
|
26 |
+
"bnb_4bit_quant_type": "fp4",
|
27 |
+
"bnb_4bit_use_double_quant": false,
|
28 |
+
"llm_int8_enable_fp32_cpu_offload": false,
|
29 |
+
"llm_int8_has_fp16_weight": false,
|
30 |
+
"llm_int8_skip_modules": null,
|
31 |
+
"llm_int8_threshold": 6.0,
|
32 |
+
"load_in_4bit": false,
|
33 |
+
"load_in_8bit": true,
|
34 |
+
"quant_method": "bitsandbytes"
|
35 |
+
},
|
36 |
+
"rms_norm_eps": 1e-06,
|
37 |
+
"rope_scaling": {
|
38 |
+
"factor": 4.0,
|
39 |
+
"rope_type": "linear",
|
40 |
+
"type": "linear"
|
41 |
+
},
|
42 |
+
"rope_theta": 100000,
|
43 |
+
"tie_word_embeddings": false,
|
44 |
+
"torch_dtype": "float16",
|
45 |
+
"transformers_version": "4.50.3",
|
46 |
+
"use_cache": true,
|
47 |
+
"vocab_size": 32256
|
48 |
+
}
|
fine-tuned-model/generation_config.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 32013,
|
4 |
+
"eos_token_id": 32021,
|
5 |
+
"pad_token_id": 32014,
|
6 |
+
"transformers_version": "4.50.3"
|
7 |
+
}
|
fine-tuned-model/model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d7d5c722eaa522148cdd50895d0b066e1cdeb624bf1cf7c77f0de1b647d74ad4
|
3 |
+
size 1480793144
|
fine-tuned-model/runs/Apr03_12-18-26_DESKTOP-SMJC97K/events.out.tfevents.1743707907.DESKTOP-SMJC97K.10280.0
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6771aa3b3f38cd0e712781343f9fd834bd6e154196579dd64c1d2c56db1fdb82
|
3 |
+
size 8286
|
fine-tuned-model/special_tokens_map.json
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": {
|
3 |
+
"content": "<|begin▁of▁sentence|>",
|
4 |
+
"lstrip": false,
|
5 |
+
"normalized": true,
|
6 |
+
"rstrip": false,
|
7 |
+
"single_word": false
|
8 |
+
},
|
9 |
+
"eos_token": {
|
10 |
+
"content": "<|EOT|>",
|
11 |
+
"lstrip": false,
|
12 |
+
"normalized": true,
|
13 |
+
"rstrip": false,
|
14 |
+
"single_word": false
|
15 |
+
},
|
16 |
+
"pad_token": {
|
17 |
+
"content": "<|end▁of▁sentence|>",
|
18 |
+
"lstrip": false,
|
19 |
+
"normalized": true,
|
20 |
+
"rstrip": false,
|
21 |
+
"single_word": false
|
22 |
+
}
|
23 |
+
}
|
fine-tuned-model/tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
fine-tuned-model/tokenizer_config.json
ADDED
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_bos_token": true,
|
3 |
+
"add_eos_token": false,
|
4 |
+
"add_prefix_space": null,
|
5 |
+
"added_tokens_decoder": {
|
6 |
+
"32000": {
|
7 |
+
"content": "õ",
|
8 |
+
"lstrip": false,
|
9 |
+
"normalized": true,
|
10 |
+
"rstrip": false,
|
11 |
+
"single_word": false,
|
12 |
+
"special": false
|
13 |
+
},
|
14 |
+
"32001": {
|
15 |
+
"content": "÷",
|
16 |
+
"lstrip": false,
|
17 |
+
"normalized": true,
|
18 |
+
"rstrip": false,
|
19 |
+
"single_word": false,
|
20 |
+
"special": false
|
21 |
+
},
|
22 |
+
"32002": {
|
23 |
+
"content": "Á",
|
24 |
+
"lstrip": false,
|
25 |
+
"normalized": true,
|
26 |
+
"rstrip": false,
|
27 |
+
"single_word": false,
|
28 |
+
"special": false
|
29 |
+
},
|
30 |
+
"32003": {
|
31 |
+
"content": "ý",
|
32 |
+
"lstrip": false,
|
33 |
+
"normalized": true,
|
34 |
+
"rstrip": false,
|
35 |
+
"single_word": false,
|
36 |
+
"special": false
|
37 |
+
},
|
38 |
+
"32004": {
|
39 |
+
"content": "À",
|
40 |
+
"lstrip": false,
|
41 |
+
"normalized": true,
|
42 |
+
"rstrip": false,
|
43 |
+
"single_word": false,
|
44 |
+
"special": false
|
45 |
+
},
|
46 |
+
"32005": {
|
47 |
+
"content": "ÿ",
|
48 |
+
"lstrip": false,
|
49 |
+
"normalized": true,
|
50 |
+
"rstrip": false,
|
51 |
+
"single_word": false,
|
52 |
+
"special": false
|
53 |
+
},
|
54 |
+
"32006": {
|
55 |
+
"content": "ø",
|
56 |
+
"lstrip": false,
|
57 |
+
"normalized": true,
|
58 |
+
"rstrip": false,
|
59 |
+
"single_word": false,
|
60 |
+
"special": false
|
61 |
+
},
|
62 |
+
"32007": {
|
63 |
+
"content": "ú",
|
64 |
+
"lstrip": false,
|
65 |
+
"normalized": true,
|
66 |
+
"rstrip": false,
|
67 |
+
"single_word": false,
|
68 |
+
"special": false
|
69 |
+
},
|
70 |
+
"32008": {
|
71 |
+
"content": "þ",
|
72 |
+
"lstrip": false,
|
73 |
+
"normalized": true,
|
74 |
+
"rstrip": false,
|
75 |
+
"single_word": false,
|
76 |
+
"special": false
|
77 |
+
},
|
78 |
+
"32009": {
|
79 |
+
"content": "ü",
|
80 |
+
"lstrip": false,
|
81 |
+
"normalized": true,
|
82 |
+
"rstrip": false,
|
83 |
+
"single_word": false,
|
84 |
+
"special": false
|
85 |
+
},
|
86 |
+
"32010": {
|
87 |
+
"content": "ù",
|
88 |
+
"lstrip": false,
|
89 |
+
"normalized": true,
|
90 |
+
"rstrip": false,
|
91 |
+
"single_word": false,
|
92 |
+
"special": false
|
93 |
+
},
|
94 |
+
"32011": {
|
95 |
+
"content": "ö",
|
96 |
+
"lstrip": false,
|
97 |
+
"normalized": true,
|
98 |
+
"rstrip": false,
|
99 |
+
"single_word": false,
|
100 |
+
"special": false
|
101 |
+
},
|
102 |
+
"32012": {
|
103 |
+
"content": "û",
|
104 |
+
"lstrip": false,
|
105 |
+
"normalized": true,
|
106 |
+
"rstrip": false,
|
107 |
+
"single_word": false,
|
108 |
+
"special": false
|
109 |
+
},
|
110 |
+
"32013": {
|
111 |
+
"content": "<|begin▁of▁sentence|>",
|
112 |
+
"lstrip": false,
|
113 |
+
"normalized": true,
|
114 |
+
"rstrip": false,
|
115 |
+
"single_word": false,
|
116 |
+
"special": true
|
117 |
+
},
|
118 |
+
"32014": {
|
119 |
+
"content": "<|end▁of▁sentence|>",
|
120 |
+
"lstrip": false,
|
121 |
+
"normalized": true,
|
122 |
+
"rstrip": false,
|
123 |
+
"single_word": false,
|
124 |
+
"special": true
|
125 |
+
},
|
126 |
+
"32015": {
|
127 |
+
"content": "<|fim▁hole|>",
|
128 |
+
"lstrip": false,
|
129 |
+
"normalized": true,
|
130 |
+
"rstrip": false,
|
131 |
+
"single_word": false,
|
132 |
+
"special": false
|
133 |
+
},
|
134 |
+
"32016": {
|
135 |
+
"content": "<|fim▁begin|>",
|
136 |
+
"lstrip": false,
|
137 |
+
"normalized": true,
|
138 |
+
"rstrip": false,
|
139 |
+
"single_word": false,
|
140 |
+
"special": false
|
141 |
+
},
|
142 |
+
"32017": {
|
143 |
+
"content": "<|fim▁end|>",
|
144 |
+
"lstrip": false,
|
145 |
+
"normalized": true,
|
146 |
+
"rstrip": false,
|
147 |
+
"single_word": false,
|
148 |
+
"special": false
|
149 |
+
},
|
150 |
+
"32018": {
|
151 |
+
"content": "<pad>",
|
152 |
+
"lstrip": false,
|
153 |
+
"normalized": true,
|
154 |
+
"rstrip": false,
|
155 |
+
"single_word": false,
|
156 |
+
"special": false
|
157 |
+
},
|
158 |
+
"32019": {
|
159 |
+
"content": "<|User|>",
|
160 |
+
"lstrip": false,
|
161 |
+
"normalized": true,
|
162 |
+
"rstrip": false,
|
163 |
+
"single_word": false,
|
164 |
+
"special": false
|
165 |
+
},
|
166 |
+
"32020": {
|
167 |
+
"content": "<|Assistant|>",
|
168 |
+
"lstrip": false,
|
169 |
+
"normalized": true,
|
170 |
+
"rstrip": false,
|
171 |
+
"single_word": false,
|
172 |
+
"special": false
|
173 |
+
},
|
174 |
+
"32021": {
|
175 |
+
"content": "<|EOT|>",
|
176 |
+
"lstrip": false,
|
177 |
+
"normalized": true,
|
178 |
+
"rstrip": false,
|
179 |
+
"single_word": false,
|
180 |
+
"special": true
|
181 |
+
}
|
182 |
+
},
|
183 |
+
"bos_token": "<|begin▁of▁sentence|>",
|
184 |
+
"chat_template": "{% if not add_generation_prompt is defined %}\n{% set add_generation_prompt = false %}\n{% endif %}\n{%- set ns = namespace(found=false) -%}\n{%- for message in messages -%}\n {%- if message['role'] == 'system' -%}\n {%- set ns.found = true -%}\n {%- endif -%}\n{%- endfor -%}\n{{bos_token}}{%- if not ns.found -%}\n{{'You are an AI programming assistant, utilizing the Deepseek Coder model, developed by Deepseek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer\\n'}}\n{%- endif %}\n{%- for message in messages %}\n {%- if message['role'] == 'system' %}\n{{ message['content'] }}\n {%- else %}\n {%- if message['role'] == 'user' %}\n{{'### Instruction:\\n' + message['content'] + '\\n'}}\n {%- else %}\n{{'### Response:\\n' + message['content'] + '\\n<|EOT|>\\n'}}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{% if add_generation_prompt %}\n{{'### Response:'}}\n{% endif %}",
|
185 |
+
"clean_up_tokenization_spaces": false,
|
186 |
+
"eos_token": "<|EOT|>",
|
187 |
+
"extra_special_tokens": {},
|
188 |
+
"legacy": true,
|
189 |
+
"model_max_length": 16384,
|
190 |
+
"pad_token": "<|end▁of▁sentence|>",
|
191 |
+
"sp_model_kwargs": {},
|
192 |
+
"tokenizer_class": "LlamaTokenizerFast",
|
193 |
+
"unk_token": null,
|
194 |
+
"use_default_system_prompt": false
|
195 |
+
}
|
finetune_model.ipynb
CHANGED
@@ -11,186 +11,13 @@
|
|
11 |
"cell_type": "markdown",
|
12 |
"metadata": {},
|
13 |
"source": [
|
14 |
-
"## First
|
15 |
]
|
16 |
},
|
17 |
{
|
18 |
"cell_type": "code",
|
19 |
"execution_count": 1,
|
20 |
"metadata": {},
|
21 |
-
"outputs": [
|
22 |
-
{
|
23 |
-
"name": "stderr",
|
24 |
-
"output_type": "stream",
|
25 |
-
"text": [
|
26 |
-
"c:\\Users\\Dean\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\tqdm\\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
|
27 |
-
" from .autonotebook import tqdm as notebook_tqdm\n"
|
28 |
-
]
|
29 |
-
},
|
30 |
-
{
|
31 |
-
"name": "stdout",
|
32 |
-
"output_type": "stream",
|
33 |
-
"text": [
|
34 |
-
"WARNING:tensorflow:From c:\\Users\\Dean\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\tf_keras\\src\\losses.py:2976: The name tf.losses.sparse_softmax_cross_entropy is deprecated. Please use tf.compat.v1.losses.sparse_softmax_cross_entropy instead.\n",
|
35 |
-
"\n",
|
36 |
-
"Total dataset examples: 1044\n",
|
37 |
-
" natural_query \\\n",
|
38 |
-
"0 Which NBA teams were established after the yea... \n",
|
39 |
-
"1 What is the most points the Los Angeles Lakers... \n",
|
40 |
-
"2 What is the second-highest number of points th... \n",
|
41 |
-
"3 How many home games did the Golden State Warri... \n",
|
42 |
-
"4 What is the average number of assists by the B... \n",
|
43 |
-
"\n",
|
44 |
-
" sql_query result \n",
|
45 |
-
"0 SELECT full_name FROM team WHERE year_founded ... New Orleans Pelicans \n",
|
46 |
-
"1 SELECT MAX(pts_home) FROM game WHERE team_nam... 162 \n",
|
47 |
-
"2 SELECT pts_home FROM game WHERE team_name_home... 156 \n",
|
48 |
-
"3 SELECT COUNT(*) FROM game WHERE team_abbrevi... 29 \n",
|
49 |
-
"4 SELECT AVG(ast_home) FROM game WHERE team_ab... 26.51355662 \n"
|
50 |
-
]
|
51 |
-
},
|
52 |
-
{
|
53 |
-
"name": "stderr",
|
54 |
-
"output_type": "stream",
|
55 |
-
"text": [
|
56 |
-
"Map: 100%|██████████| 1044/1044 [00:00<00:00, 4433.07 examples/s]"
|
57 |
-
]
|
58 |
-
},
|
59 |
-
{
|
60 |
-
"name": "stdout",
|
61 |
-
"output_type": "stream",
|
62 |
-
"text": [
|
63 |
-
"939\n",
|
64 |
-
"105\n"
|
65 |
-
]
|
66 |
-
},
|
67 |
-
{
|
68 |
-
"name": "stderr",
|
69 |
-
"output_type": "stream",
|
70 |
-
"text": [
|
71 |
-
"\n"
|
72 |
-
]
|
73 |
-
}
|
74 |
-
],
|
75 |
-
"source": [
|
76 |
-
"import pandas as pd\n",
|
77 |
-
"import torch\n",
|
78 |
-
"from datasets import Dataset\n",
|
79 |
-
"from transformers import AutoTokenizer, AutoModelForCausalLM, TrainingArguments, Trainer, BitsAndBytesConfig\n",
|
80 |
-
"from torch.utils.data import DataLoader\n",
|
81 |
-
"from peft import LoraConfig, get_peft_model, TaskType\n",
|
82 |
-
"import os\n",
|
83 |
-
"\n",
|
84 |
-
"# Load dataset\n",
|
85 |
-
"df = pd.read_csv(\"./train-data/sql_train.tsv\", sep='\\t')\n",
|
86 |
-
"\n",
|
87 |
-
"# Display dataset info\n",
|
88 |
-
"print(f\"Total dataset examples: {len(df)}\")\n",
|
89 |
-
"print(df.head())\n",
|
90 |
-
"\n",
|
91 |
-
"# Load tokenizer\n",
|
92 |
-
"model_name = \"./deepseek-coder-1.3b-instruct\"\n",
|
93 |
-
"tokenizer = AutoTokenizer.from_pretrained(model_name)\n",
|
94 |
-
"\n",
|
95 |
-
"# Preprocessing function\n",
|
96 |
-
"def preprocess_function(examples):\n",
|
97 |
-
" \"\"\"\n",
|
98 |
-
" Tokenizes input natural language queries and corresponding SQL queries.\n",
|
99 |
-
" \"\"\"\n",
|
100 |
-
" inputs = [\"Translate to SQL: \" + q for q in examples[\"natural_query\"]]\n",
|
101 |
-
" targets = examples[\"sql_query\"]\n",
|
102 |
-
"\n",
|
103 |
-
" model_inputs = tokenizer(inputs, padding=\"max_length\", truncation=True, max_length=256)\n",
|
104 |
-
" labels = tokenizer(targets, padding=\"max_length\", truncation=True, max_length=256)\n",
|
105 |
-
"\n",
|
106 |
-
" model_inputs[\"labels\"] = labels[\"input_ids\"]\n",
|
107 |
-
" return model_inputs\n",
|
108 |
-
"\n",
|
109 |
-
"# Convert to Hugging Face Dataset\n",
|
110 |
-
"dataset = Dataset.from_pandas(df)\n",
|
111 |
-
"\n",
|
112 |
-
"# Apply tokenization\n",
|
113 |
-
"tokenized_dataset = dataset.map(preprocess_function, batched=True)\n",
|
114 |
-
"\n",
|
115 |
-
"# Split into train/validation\n",
|
116 |
-
"split = int(0.9 * len(tokenized_dataset)) # 90% train, 10% validation\n",
|
117 |
-
"train_dataset = tokenized_dataset.select(range(split))\n",
|
118 |
-
"val_dataset = tokenized_dataset.select(range(split, len(tokenized_dataset)))\n",
|
119 |
-
"\n",
|
120 |
-
"print(len(train_dataset))\n",
|
121 |
-
"print(len(val_dataset))"
|
122 |
-
]
|
123 |
-
},
|
124 |
-
{
|
125 |
-
"cell_type": "markdown",
|
126 |
-
"metadata": {},
|
127 |
-
"source": [
|
128 |
-
"## Load model and define training arguments"
|
129 |
-
]
|
130 |
-
},
|
131 |
-
{
|
132 |
-
"cell_type": "code",
|
133 |
-
"execution_count": 2,
|
134 |
-
"metadata": {},
|
135 |
-
"outputs": [
|
136 |
-
{
|
137 |
-
"name": "stdout",
|
138 |
-
"output_type": "stream",
|
139 |
-
"text": [
|
140 |
-
"trainable params: 6,291,456 || all params: 1,352,763,392 || trainable%: 0.4651\n"
|
141 |
-
]
|
142 |
-
}
|
143 |
-
],
|
144 |
-
"source": [
|
145 |
-
"# Enable 8-bit quantization for lower memory usage\n",
|
146 |
-
"bnb_config = BitsAndBytesConfig(\n",
|
147 |
-
" load_in_8bit=True, \n",
|
148 |
-
" bnb_8bit_compute_dtype=torch.float16\n",
|
149 |
-
")\n",
|
150 |
-
"\n",
|
151 |
-
"# Load model with quantization\n",
|
152 |
-
"#device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n",
|
153 |
-
"device_name = 'cuda:0' if torch.cuda.is_available() else 'cpu'\n",
|
154 |
-
"device = torch.device(device_name)\n",
|
155 |
-
"model = AutoModelForCausalLM.from_pretrained(\n",
|
156 |
-
" model_name, \n",
|
157 |
-
" quantization_config=bnb_config,\n",
|
158 |
-
" device_map=device\n",
|
159 |
-
")\n",
|
160 |
-
"model.generation_config.pad_token_id = tokenizer.pad_token_id\n",
|
161 |
-
"\n",
|
162 |
-
"# Define LoRA configuration\n",
|
163 |
-
"lora_config = LoraConfig(\n",
|
164 |
-
" r=16, # Rank of LoRA matrices (adjust for memory vs. accuracy)\n",
|
165 |
-
" lora_alpha=32, # Scaling factor\n",
|
166 |
-
" lora_dropout=0.1, # Dropout for regularization\n",
|
167 |
-
" bias=\"none\",\n",
|
168 |
-
" task_type=TaskType.CAUSAL_LM,\n",
|
169 |
-
" target_modules=[\n",
|
170 |
-
" \"q_proj\",\n",
|
171 |
-
" \"k_proj\",\n",
|
172 |
-
" \"v_proj\",\n",
|
173 |
-
" \"o_proj\"\n",
|
174 |
-
" ]\n",
|
175 |
-
")\n",
|
176 |
-
"\n",
|
177 |
-
"# Wrap model with LoRA adapters\n",
|
178 |
-
"model = get_peft_model(model, lora_config)\n",
|
179 |
-
"model = model.to(device)\n",
|
180 |
-
"model.print_trainable_parameters() # Show trainable parameters count"
|
181 |
-
]
|
182 |
-
},
|
183 |
-
{
|
184 |
-
"cell_type": "markdown",
|
185 |
-
"metadata": {},
|
186 |
-
"source": [
|
187 |
-
"## Define prompt for model"
|
188 |
-
]
|
189 |
-
},
|
190 |
-
{
|
191 |
-
"cell_type": "code",
|
192 |
-
"execution_count": 3,
|
193 |
-
"metadata": {},
|
194 |
"outputs": [],
|
195 |
"source": [
|
196 |
"input_prompt = \"\"\"You are an AI assistant that converts natural language queries into valid SQLite queries.\n",
|
@@ -378,6 +205,179 @@
|
|
378 |
"\"\"\""
|
379 |
]
|
380 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
{
|
382 |
"cell_type": "markdown",
|
383 |
"metadata": {},
|
@@ -396,7 +396,7 @@
|
|
396 |
"text": [
|
397 |
"c:\\Users\\Dean\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\transformers\\training_args.py:1611: FutureWarning: `evaluation_strategy` is deprecated and will be removed in version 4.46 of 🤗 Transformers. Use `eval_strategy` instead\n",
|
398 |
" warnings.warn(\n",
|
399 |
-
"C:\\Users\\Dean\\AppData\\Local\\Temp\\
|
400 |
" trainer = Trainer(\n",
|
401 |
"No label_names provided for model class `PeftModelForCausalLM`. Since `PeftModel` hides base models input arguments, if label_names is not given, label_names can't be set automatically within `Trainer`. Note that empty label_names list will be used instead.\n"
|
402 |
]
|
@@ -454,8 +454,8 @@
|
|
454 |
"\n",
|
455 |
" <div>\n",
|
456 |
" \n",
|
457 |
-
" <progress value='
|
458 |
-
" [
|
459 |
" </div>\n",
|
460 |
" <table border=\"1\" class=\"dataframe\">\n",
|
461 |
" <thead>\n",
|
@@ -466,6 +466,21 @@
|
|
466 |
" </tr>\n",
|
467 |
" </thead>\n",
|
468 |
" <tbody>\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
469 |
" </tbody>\n",
|
470 |
"</table><p>"
|
471 |
],
|
@@ -477,27 +492,79 @@
|
|
477 |
"output_type": "display_data"
|
478 |
},
|
479 |
{
|
480 |
-
"
|
481 |
-
"
|
482 |
-
"
|
483 |
-
|
484 |
-
"\
|
485 |
-
"\u001b[1;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
|
486 |
-
"Cell \u001b[1;32mIn[5], line 2\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;66;03m# Run training\u001b[39;00m\n\u001b[1;32m----> 2\u001b[0m \u001b[43mtrainer\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtrain\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 4\u001b[0m \u001b[38;5;66;03m# Save model and tokenizer weights\u001b[39;00m\n\u001b[0;32m 5\u001b[0m model\u001b[38;5;241m.\u001b[39msave_pretrained(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m./fine-tuned-model\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
|
487 |
-
"File \u001b[1;32mc:\\Users\\Dean\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\transformers\\trainer.py:2245\u001b[0m, in \u001b[0;36mTrainer.train\u001b[1;34m(self, resume_from_checkpoint, trial, ignore_keys_for_eval, **kwargs)\u001b[0m\n\u001b[0;32m 2243\u001b[0m hf_hub_utils\u001b[38;5;241m.\u001b[39menable_progress_bars()\n\u001b[0;32m 2244\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 2245\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43minner_training_loop\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 2246\u001b[0m \u001b[43m \u001b[49m\u001b[43margs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 2247\u001b[0m \u001b[43m \u001b[49m\u001b[43mresume_from_checkpoint\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mresume_from_checkpoint\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 2248\u001b[0m \u001b[43m \u001b[49m\u001b[43mtrial\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtrial\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 2249\u001b[0m \u001b[43m \u001b[49m\u001b[43mignore_keys_for_eval\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mignore_keys_for_eval\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 2250\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n",
|
488 |
-
"File \u001b[1;32mc:\\Users\\Dean\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\transformers\\trainer.py:2561\u001b[0m, in \u001b[0;36mTrainer._inner_training_loop\u001b[1;34m(self, batch_size, args, resume_from_checkpoint, trial, ignore_keys_for_eval)\u001b[0m\n\u001b[0;32m 2555\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m context():\n\u001b[0;32m 2556\u001b[0m tr_loss_step \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtraining_step(model, inputs, num_items_in_batch)\n\u001b[0;32m 2558\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\n\u001b[0;32m 2559\u001b[0m args\u001b[38;5;241m.\u001b[39mlogging_nan_inf_filter\n\u001b[0;32m 2560\u001b[0m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m is_torch_xla_available()\n\u001b[1;32m-> 2561\u001b[0m \u001b[38;5;129;01mand\u001b[39;00m (torch\u001b[38;5;241m.\u001b[39misnan(tr_loss_step) \u001b[38;5;129;01mor\u001b[39;00m \u001b[43mtorch\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43misinf\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtr_loss_step\u001b[49m\u001b[43m)\u001b[49m)\n\u001b[0;32m 2562\u001b[0m ):\n\u001b[0;32m 2563\u001b[0m \u001b[38;5;66;03m# if loss is nan or inf simply add the average of previous logged losses\u001b[39;00m\n\u001b[0;32m 2564\u001b[0m tr_loss \u001b[38;5;241m=\u001b[39m tr_loss \u001b[38;5;241m+\u001b[39m tr_loss \u001b[38;5;241m/\u001b[39m (\u001b[38;5;241m1\u001b[39m \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mstate\u001b[38;5;241m.\u001b[39mglobal_step \u001b[38;5;241m-\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_globalstep_last_logged)\n\u001b[0;32m 2565\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n",
|
489 |
-
"\u001b[1;31mKeyboardInterrupt\u001b[0m: "
|
490 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
491 |
}
|
492 |
],
|
493 |
"source": [
|
494 |
"# Run training\n",
|
495 |
"trainer.train()\n",
|
496 |
"\n",
|
497 |
-
"#
|
|
|
498 |
"model.save_pretrained(\"./fine-tuned-model\")\n",
|
499 |
"tokenizer.save_pretrained(\"./fine-tuned-model\")"
|
500 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
501 |
}
|
502 |
],
|
503 |
"metadata": {
|
|
|
11 |
"cell_type": "markdown",
|
12 |
"metadata": {},
|
13 |
"source": [
|
14 |
+
"## First define prompt"
|
15 |
]
|
16 |
},
|
17 |
{
|
18 |
"cell_type": "code",
|
19 |
"execution_count": 1,
|
20 |
"metadata": {},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
"outputs": [],
|
22 |
"source": [
|
23 |
"input_prompt = \"\"\"You are an AI assistant that converts natural language queries into valid SQLite queries.\n",
|
|
|
205 |
"\"\"\""
|
206 |
]
|
207 |
},
|
208 |
+
{
|
209 |
+
"cell_type": "markdown",
|
210 |
+
"metadata": {},
|
211 |
+
"source": [
|
212 |
+
"## Load data and convert to Dataset object tokenized by the DeepSeek model"
|
213 |
+
]
|
214 |
+
},
|
215 |
+
{
|
216 |
+
"cell_type": "code",
|
217 |
+
"execution_count": 2,
|
218 |
+
"metadata": {},
|
219 |
+
"outputs": [
|
220 |
+
{
|
221 |
+
"name": "stderr",
|
222 |
+
"output_type": "stream",
|
223 |
+
"text": [
|
224 |
+
"c:\\Users\\Dean\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\tqdm\\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
|
225 |
+
" from .autonotebook import tqdm as notebook_tqdm\n"
|
226 |
+
]
|
227 |
+
},
|
228 |
+
{
|
229 |
+
"name": "stdout",
|
230 |
+
"output_type": "stream",
|
231 |
+
"text": [
|
232 |
+
"WARNING:tensorflow:From c:\\Users\\Dean\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\tf_keras\\src\\losses.py:2976: The name tf.losses.sparse_softmax_cross_entropy is deprecated. Please use tf.compat.v1.losses.sparse_softmax_cross_entropy instead.\n",
|
233 |
+
"\n",
|
234 |
+
"Total dataset examples: 1044\n",
|
235 |
+
" natural_query \\\n",
|
236 |
+
"0 Which NBA teams were established after the yea... \n",
|
237 |
+
"1 What is the most points the Los Angeles Lakers... \n",
|
238 |
+
"2 What is the second-highest number of points th... \n",
|
239 |
+
"3 How many home games did the Golden State Warri... \n",
|
240 |
+
"4 What is the average number of assists by the B... \n",
|
241 |
+
"\n",
|
242 |
+
" sql_query result \n",
|
243 |
+
"0 SELECT full_name FROM team WHERE year_founded ... New Orleans Pelicans \n",
|
244 |
+
"1 SELECT MAX(pts_home) FROM game WHERE team_nam... 162 \n",
|
245 |
+
"2 SELECT pts_home FROM game WHERE team_name_home... 156 \n",
|
246 |
+
"3 SELECT COUNT(*) FROM game WHERE team_abbrevi... 29 \n",
|
247 |
+
"4 SELECT AVG(ast_home) FROM game WHERE team_ab... 26.51355662 \n"
|
248 |
+
]
|
249 |
+
},
|
250 |
+
{
|
251 |
+
"name": "stderr",
|
252 |
+
"output_type": "stream",
|
253 |
+
"text": [
|
254 |
+
"Map: 100%|██████████| 1044/1044 [00:01<00:00, 543.61 examples/s]"
|
255 |
+
]
|
256 |
+
},
|
257 |
+
{
|
258 |
+
"name": "stdout",
|
259 |
+
"output_type": "stream",
|
260 |
+
"text": [
|
261 |
+
"939\n",
|
262 |
+
"105\n"
|
263 |
+
]
|
264 |
+
},
|
265 |
+
{
|
266 |
+
"name": "stderr",
|
267 |
+
"output_type": "stream",
|
268 |
+
"text": [
|
269 |
+
"\n"
|
270 |
+
]
|
271 |
+
}
|
272 |
+
],
|
273 |
+
"source": [
|
274 |
+
"import pandas as pd\n",
|
275 |
+
"import torch\n",
|
276 |
+
"from datasets import Dataset\n",
|
277 |
+
"from transformers import AutoTokenizer, AutoModelForCausalLM, TrainingArguments, Trainer, BitsAndBytesConfig\n",
|
278 |
+
"from torch.utils.data import DataLoader\n",
|
279 |
+
"from peft import LoraConfig, get_peft_model, TaskType\n",
|
280 |
+
"import os\n",
|
281 |
+
"\n",
|
282 |
+
"# Load dataset\n",
|
283 |
+
"df = pd.read_csv(\"./train-data/sql_train.tsv\", sep='\\t')\n",
|
284 |
+
"\n",
|
285 |
+
"# Display dataset info\n",
|
286 |
+
"print(f\"Total dataset examples: {len(df)}\")\n",
|
287 |
+
"print(df.head())\n",
|
288 |
+
"\n",
|
289 |
+
"# Load tokenizer\n",
|
290 |
+
"model_name = \"./deepseek-coder-1.3b-instruct\"\n",
|
291 |
+
"tokenizer = AutoTokenizer.from_pretrained(model_name)\n",
|
292 |
+
"\n",
|
293 |
+
"# Preprocessing function\n",
|
294 |
+
"def preprocess_function(examples):\n",
|
295 |
+
" \"\"\"\n",
|
296 |
+
" Tokenizes input natural language queries and corresponding SQL queries.\n",
|
297 |
+
" \"\"\"\n",
|
298 |
+
" inputs = [input_prompt + q for q in examples[\"natural_query\"]]\n",
|
299 |
+
" targets = examples[\"sql_query\"]\n",
|
300 |
+
"\n",
|
301 |
+
" model_inputs = tokenizer(inputs, padding=\"max_length\", truncation=True, max_length=256)\n",
|
302 |
+
" labels = tokenizer(targets, padding=\"max_length\", truncation=True, max_length=256)\n",
|
303 |
+
"\n",
|
304 |
+
" model_inputs[\"labels\"] = labels[\"input_ids\"]\n",
|
305 |
+
" return model_inputs\n",
|
306 |
+
"\n",
|
307 |
+
"# Convert to Hugging Face Dataset\n",
|
308 |
+
"dataset = Dataset.from_pandas(df)\n",
|
309 |
+
"\n",
|
310 |
+
"# Apply tokenization\n",
|
311 |
+
"tokenized_dataset = dataset.map(preprocess_function, batched=True)\n",
|
312 |
+
"\n",
|
313 |
+
"# Split into train/validation\n",
|
314 |
+
"split = int(0.9 * len(tokenized_dataset)) # 90% train, 10% validation\n",
|
315 |
+
"train_dataset = tokenized_dataset.select(range(split))\n",
|
316 |
+
"val_dataset = tokenized_dataset.select(range(split, len(tokenized_dataset)))\n",
|
317 |
+
"\n",
|
318 |
+
"print(len(train_dataset))\n",
|
319 |
+
"print(len(val_dataset))"
|
320 |
+
]
|
321 |
+
},
|
322 |
+
{
|
323 |
+
"cell_type": "markdown",
|
324 |
+
"metadata": {},
|
325 |
+
"source": [
|
326 |
+
"## Load model and define training arguments"
|
327 |
+
]
|
328 |
+
},
|
329 |
+
{
|
330 |
+
"cell_type": "code",
|
331 |
+
"execution_count": 3,
|
332 |
+
"metadata": {},
|
333 |
+
"outputs": [
|
334 |
+
{
|
335 |
+
"name": "stdout",
|
336 |
+
"output_type": "stream",
|
337 |
+
"text": [
|
338 |
+
"trainable params: 6,291,456 || all params: 1,352,763,392 || trainable%: 0.4651\n"
|
339 |
+
]
|
340 |
+
}
|
341 |
+
],
|
342 |
+
"source": [
|
343 |
+
"# Enable 8-bit quantization for lower memory usage\n",
|
344 |
+
"bnb_config = BitsAndBytesConfig(\n",
|
345 |
+
" load_in_8bit=True, \n",
|
346 |
+
" bnb_8bit_compute_dtype=torch.float16\n",
|
347 |
+
")\n",
|
348 |
+
"\n",
|
349 |
+
"# Load model with quantization\n",
|
350 |
+
"#device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n",
|
351 |
+
"device_name = 'cuda:0' if torch.cuda.is_available() else 'cpu'\n",
|
352 |
+
"device = torch.device(device_name)\n",
|
353 |
+
"model = AutoModelForCausalLM.from_pretrained(\n",
|
354 |
+
" model_name, \n",
|
355 |
+
" quantization_config=bnb_config,\n",
|
356 |
+
" device_map=device\n",
|
357 |
+
")\n",
|
358 |
+
"model.generation_config.pad_token_id = tokenizer.pad_token_id\n",
|
359 |
+
"\n",
|
360 |
+
"# Define LoRA configuration\n",
|
361 |
+
"lora_config = LoraConfig(\n",
|
362 |
+
" r=16, # Rank of LoRA matrices (adjust for memory vs. accuracy)\n",
|
363 |
+
" lora_alpha=32, # Scaling factor\n",
|
364 |
+
" lora_dropout=0.1, # Dropout for regularization\n",
|
365 |
+
" bias=\"none\",\n",
|
366 |
+
" task_type=TaskType.CAUSAL_LM,\n",
|
367 |
+
" target_modules=[\n",
|
368 |
+
" \"q_proj\",\n",
|
369 |
+
" \"k_proj\",\n",
|
370 |
+
" \"v_proj\",\n",
|
371 |
+
" \"o_proj\"\n",
|
372 |
+
" ]\n",
|
373 |
+
")\n",
|
374 |
+
"\n",
|
375 |
+
"# Wrap model with LoRA adapters\n",
|
376 |
+
"model = get_peft_model(model, lora_config)\n",
|
377 |
+
"model = model.to(device)\n",
|
378 |
+
"model.print_trainable_parameters() # Show trainable parameters count"
|
379 |
+
]
|
380 |
+
},
|
381 |
{
|
382 |
"cell_type": "markdown",
|
383 |
"metadata": {},
|
|
|
396 |
"text": [
|
397 |
"c:\\Users\\Dean\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\transformers\\training_args.py:1611: FutureWarning: `evaluation_strategy` is deprecated and will be removed in version 4.46 of 🤗 Transformers. Use `eval_strategy` instead\n",
|
398 |
" warnings.warn(\n",
|
399 |
+
"C:\\Users\\Dean\\AppData\\Local\\Temp\\ipykernel_10280\\3557190339.py:17: FutureWarning: `tokenizer` is deprecated and will be removed in version 5.0.0 for `Trainer.__init__`. Use `processing_class` instead.\n",
|
400 |
" trainer = Trainer(\n",
|
401 |
"No label_names provided for model class `PeftModelForCausalLM`. Since `PeftModel` hides base models input arguments, if label_names is not given, label_names can't be set automatically within `Trainer`. Note that empty label_names list will be used instead.\n"
|
402 |
]
|
|
|
454 |
"\n",
|
455 |
" <div>\n",
|
456 |
" \n",
|
457 |
+
" <progress value='354' max='354' style='width:300px; height:20px; vertical-align: middle;'></progress>\n",
|
458 |
+
" [354/354 05:21, Epoch 3/3]\n",
|
459 |
" </div>\n",
|
460 |
" <table border=\"1\" class=\"dataframe\">\n",
|
461 |
" <thead>\n",
|
|
|
466 |
" </tr>\n",
|
467 |
" </thead>\n",
|
468 |
" <tbody>\n",
|
469 |
+
" <tr>\n",
|
470 |
+
" <td>1</td>\n",
|
471 |
+
" <td>1.235600</td>\n",
|
472 |
+
" <td>0.970917</td>\n",
|
473 |
+
" </tr>\n",
|
474 |
+
" <tr>\n",
|
475 |
+
" <td>2</td>\n",
|
476 |
+
" <td>1.233100</td>\n",
|
477 |
+
" <td>0.937016</td>\n",
|
478 |
+
" </tr>\n",
|
479 |
+
" <tr>\n",
|
480 |
+
" <td>3</td>\n",
|
481 |
+
" <td>1.157600</td>\n",
|
482 |
+
" <td>0.940143</td>\n",
|
483 |
+
" </tr>\n",
|
484 |
" </tbody>\n",
|
485 |
"</table><p>"
|
486 |
],
|
|
|
492 |
"output_type": "display_data"
|
493 |
},
|
494 |
{
|
495 |
+
"name": "stderr",
|
496 |
+
"output_type": "stream",
|
497 |
+
"text": [
|
498 |
+
"c:\\Users\\Dean\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\peft\\tuners\\lora\\bnb.py:85: UserWarning: Merge lora module to 8-bit linear may get different generations due to rounding errors.\n",
|
499 |
+
" warnings.warn(\n"
|
|
|
|
|
|
|
|
|
|
|
500 |
]
|
501 |
+
},
|
502 |
+
{
|
503 |
+
"data": {
|
504 |
+
"text/plain": [
|
505 |
+
"('./fine-tuned-model\\\\tokenizer_config.json',\n",
|
506 |
+
" './fine-tuned-model\\\\special_tokens_map.json',\n",
|
507 |
+
" './fine-tuned-model\\\\tokenizer.json')"
|
508 |
+
]
|
509 |
+
},
|
510 |
+
"execution_count": 5,
|
511 |
+
"metadata": {},
|
512 |
+
"output_type": "execute_result"
|
513 |
}
|
514 |
],
|
515 |
"source": [
|
516 |
"# Run training\n",
|
517 |
"trainer.train()\n",
|
518 |
"\n",
|
519 |
+
"# Merge LoRA adapters with the base model before saving\n",
|
520 |
+
"model = model.merge_and_unload()\n",
|
521 |
"model.save_pretrained(\"./fine-tuned-model\")\n",
|
522 |
"tokenizer.save_pretrained(\"./fine-tuned-model\")"
|
523 |
]
|
524 |
+
},
|
525 |
+
{
|
526 |
+
"cell_type": "markdown",
|
527 |
+
"metadata": {},
|
528 |
+
"source": [
|
529 |
+
"## Try inference using fine-tuned model"
|
530 |
+
]
|
531 |
+
},
|
532 |
+
{
|
533 |
+
"cell_type": "code",
|
534 |
+
"execution_count": 6,
|
535 |
+
"metadata": {},
|
536 |
+
"outputs": [
|
537 |
+
{
|
538 |
+
"name": "stderr",
|
539 |
+
"output_type": "stream",
|
540 |
+
"text": [
|
541 |
+
"c:\\Users\\Dean\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\bitsandbytes\\autograd\\_functions.py:315: UserWarning: MatMul8bitLt: inputs will be cast from torch.bfloat16 to float16 during quantization\n",
|
542 |
+
" warnings.warn(f\"MatMul8bitLt: inputs will be cast from {A.dtype} to float16 during quantization\")\n"
|
543 |
+
]
|
544 |
+
},
|
545 |
+
{
|
546 |
+
"name": "stdout",
|
547 |
+
"output_type": "stream",
|
548 |
+
"text": [
|
549 |
+
"Generated SQL: SELECT_________________________________________________________________________________________________________\n"
|
550 |
+
]
|
551 |
+
}
|
552 |
+
],
|
553 |
+
"source": [
|
554 |
+
"model = AutoModelForCausalLM.from_pretrained(\"./fine-tuned-model\", torch_dtype=torch.bfloat16, device_map=device)\n",
|
555 |
+
"tokenizer = AutoTokenizer.from_pretrained(\"./fine-tuned-model\")\n",
|
556 |
+
"\n",
|
557 |
+
"# Prepare query with the same prompt\n",
|
558 |
+
"input_text = \"Show the top 5 highest-scoring NBA games in history.\"\n",
|
559 |
+
"message = [{'role': 'user', 'content': input_prompt + input_text}]\n",
|
560 |
+
"inputs = tokenizer.apply_chat_template(message, add_generation_prompt=True, return_tensors=\"pt\").to(model.device)\n",
|
561 |
+
"\n",
|
562 |
+
"# Generate SQL query\n",
|
563 |
+
"outputs = model.generate(inputs, max_new_tokens=512, do_sample=False)\n",
|
564 |
+
"query_output = tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True)\n",
|
565 |
+
"\n",
|
566 |
+
"print(\"Generated SQL:\", query_output)"
|
567 |
+
]
|
568 |
}
|
569 |
],
|
570 |
"metadata": {
|