wangzerui commited on
Commit
6eb2110
·
1 Parent(s): 7dc564b

Add application file

Browse files
checkpoint-2800/README.md ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: peft
3
+ base_model: meta-llama/Llama-2-13b-hf
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
+ - **Shared by [optional]:** [More Information Needed]
22
+ - **Model type:** [More Information Needed]
23
+ - **Language(s) (NLP):** [More Information Needed]
24
+ - **License:** [More Information Needed]
25
+ - **Finetuned from model [optional]:** [More Information Needed]
26
+
27
+ ### Model Sources [optional]
28
+
29
+ <!-- Provide the basic links for the model. -->
30
+
31
+ - **Repository:** [More Information Needed]
32
+ - **Paper [optional]:** [More Information Needed]
33
+ - **Demo [optional]:** [More Information Needed]
34
+
35
+ ## Uses
36
+
37
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
38
+
39
+ ### Direct Use
40
+
41
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
42
+
43
+ [More Information Needed]
44
+
45
+ ### Downstream Use [optional]
46
+
47
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
48
+
49
+ [More Information Needed]
50
+
51
+ ### Out-of-Scope Use
52
+
53
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
54
+
55
+ [More Information Needed]
56
+
57
+ ## Bias, Risks, and Limitations
58
+
59
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
60
+
61
+ [More Information Needed]
62
+
63
+ ### Recommendations
64
+
65
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
66
+
67
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
68
+
69
+ ## How to Get Started with the Model
70
+
71
+ Use the code below to get started with the model.
72
+
73
+ [More Information Needed]
74
+
75
+ ## Training Details
76
+
77
+ ### Training Data
78
+
79
+ <!-- This should link to a Data 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. -->
80
+
81
+ [More Information Needed]
82
+
83
+ ### Training Procedure
84
+
85
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
86
+
87
+ #### Preprocessing [optional]
88
+
89
+ [More Information Needed]
90
+
91
+
92
+ #### Training Hyperparameters
93
+
94
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
95
+
96
+ #### Speeds, Sizes, Times [optional]
97
+
98
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
99
+
100
+ [More Information Needed]
101
+
102
+ ## Evaluation
103
+
104
+ <!-- This section describes the evaluation protocols and provides the results. -->
105
+
106
+ ### Testing Data, Factors & Metrics
107
+
108
+ #### Testing Data
109
+
110
+ <!-- This should link to a Data Card if possible. -->
111
+
112
+ [More Information Needed]
113
+
114
+ #### Factors
115
+
116
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
117
+
118
+ [More Information Needed]
119
+
120
+ #### Metrics
121
+
122
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
123
+
124
+ [More Information Needed]
125
+
126
+ ### Results
127
+
128
+ [More Information Needed]
129
+
130
+ #### Summary
131
+
132
+
133
+
134
+ ## Model Examination [optional]
135
+
136
+ <!-- Relevant interpretability work for the model goes here -->
137
+
138
+ [More Information Needed]
139
+
140
+ ## Environmental Impact
141
+
142
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
143
+
144
+ 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).
145
+
146
+ - **Hardware Type:** [More Information Needed]
147
+ - **Hours used:** [More Information Needed]
148
+ - **Cloud Provider:** [More Information Needed]
149
+ - **Compute Region:** [More Information Needed]
150
+ - **Carbon Emitted:** [More Information Needed]
151
+
152
+ ## Technical Specifications [optional]
153
+
154
+ ### Model Architecture and Objective
155
+
156
+ [More Information Needed]
157
+
158
+ ### Compute Infrastructure
159
+
160
+ [More Information Needed]
161
+
162
+ #### Hardware
163
+
164
+ [More Information Needed]
165
+
166
+ #### Software
167
+
168
+ [More Information Needed]
169
+
170
+ ## Citation [optional]
171
+
172
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
173
+
174
+ **BibTeX:**
175
+
176
+ [More Information Needed]
177
+
178
+ **APA:**
179
+
180
+ [More Information Needed]
181
+
182
+ ## Glossary [optional]
183
+
184
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
185
+
186
+ [More Information Needed]
187
+
188
+ ## More Information [optional]
189
+
190
+ [More Information Needed]
191
+
192
+ ## Model Card Authors [optional]
193
+
194
+ [More Information Needed]
195
+
196
+ ## Model Card Contact
197
+
198
+ [More Information Needed]
199
+
200
+
201
+ ## Training procedure
202
+
203
+
204
+ The following `bitsandbytes` quantization config was used during training:
205
+ - quant_method: bitsandbytes
206
+ - load_in_8bit: False
207
+ - load_in_4bit: True
208
+ - llm_int8_threshold: 6.0
209
+ - llm_int8_skip_modules: None
210
+ - llm_int8_enable_fp32_cpu_offload: False
211
+ - llm_int8_has_fp16_weight: False
212
+ - bnb_4bit_quant_type: nf4
213
+ - bnb_4bit_use_double_quant: True
214
+ - bnb_4bit_compute_dtype: bfloat16
215
+
216
+ ### Framework versions
217
+
218
+
219
+ - PEFT 0.6.2.dev0
checkpoint-2800/adapter_config.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "meta-llama/Llama-2-13b-hf",
5
+ "bias": "none",
6
+ "fan_in_fan_out": false,
7
+ "inference_mode": true,
8
+ "init_lora_weights": true,
9
+ "layers_pattern": null,
10
+ "layers_to_transform": null,
11
+ "lora_alpha": 64,
12
+ "lora_dropout": 0.05,
13
+ "modules_to_save": null,
14
+ "peft_type": "LORA",
15
+ "r": 32,
16
+ "rank_pattern": {},
17
+ "revision": null,
18
+ "target_modules": [
19
+ "q_proj",
20
+ "k_proj"
21
+ ],
22
+ "task_type": "CAUSAL_LM"
23
+ }
checkpoint-2800/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:63b7e55789f3bbad419df2de076ed7229815c0b9b4fc1c23f12ab92316752e7b
3
+ size 104879176
checkpoint-2800/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:34aa5b46cd7c031d3ed81730e3b1cd1a03a8dd43aec237435062df85244de16e
3
+ size 52724090
checkpoint-2800/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9398114854b219216b264811fd3bc69535fa03dc2c646a54e22e86021ef0e032
3
+ size 14244
checkpoint-2800/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4bbae7002632658f22be934efc691b897c3c1fb5e80e85a9c5b3c230e7672a91
3
+ size 1064
checkpoint-2800/trainer_state.json ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 22.44488977955912,
5
+ "eval_steps": 100,
6
+ "global_step": 2800,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "epoch": 0.8,
13
+ "eval_loss": 1.9484879970550537,
14
+ "eval_runtime": 80.1777,
15
+ "eval_samples_per_second": 2.769,
16
+ "eval_steps_per_second": 0.349,
17
+ "step": 100
18
+ },
19
+ {
20
+ "epoch": 1.6,
21
+ "eval_loss": 1.9194128513336182,
22
+ "eval_runtime": 75.485,
23
+ "eval_samples_per_second": 2.941,
24
+ "eval_steps_per_second": 0.371,
25
+ "step": 200
26
+ },
27
+ {
28
+ "epoch": 2.4,
29
+ "eval_loss": 1.9068584442138672,
30
+ "eval_runtime": 75.624,
31
+ "eval_samples_per_second": 2.936,
32
+ "eval_steps_per_second": 0.37,
33
+ "step": 300
34
+ },
35
+ {
36
+ "epoch": 3.21,
37
+ "eval_loss": 1.8953101634979248,
38
+ "eval_runtime": 75.4707,
39
+ "eval_samples_per_second": 2.942,
40
+ "eval_steps_per_second": 0.371,
41
+ "step": 400
42
+ },
43
+ {
44
+ "epoch": 4.01,
45
+ "learning_rate": 2.08611481975968e-05,
46
+ "loss": 1.9094,
47
+ "step": 500
48
+ },
49
+ {
50
+ "epoch": 4.01,
51
+ "eval_loss": 1.8837881088256836,
52
+ "eval_runtime": 75.6492,
53
+ "eval_samples_per_second": 2.935,
54
+ "eval_steps_per_second": 0.37,
55
+ "step": 500
56
+ },
57
+ {
58
+ "epoch": 4.81,
59
+ "eval_loss": 1.8737961053848267,
60
+ "eval_runtime": 75.486,
61
+ "eval_samples_per_second": 2.941,
62
+ "eval_steps_per_second": 0.371,
63
+ "step": 600
64
+ },
65
+ {
66
+ "epoch": 5.61,
67
+ "eval_loss": 1.8641096353530884,
68
+ "eval_runtime": 75.4927,
69
+ "eval_samples_per_second": 2.941,
70
+ "eval_steps_per_second": 0.371,
71
+ "step": 700
72
+ },
73
+ {
74
+ "epoch": 6.41,
75
+ "eval_loss": 1.8550605773925781,
76
+ "eval_runtime": 75.4778,
77
+ "eval_samples_per_second": 2.941,
78
+ "eval_steps_per_second": 0.371,
79
+ "step": 800
80
+ },
81
+ {
82
+ "epoch": 7.21,
83
+ "eval_loss": 1.8458194732666016,
84
+ "eval_runtime": 75.4994,
85
+ "eval_samples_per_second": 2.94,
86
+ "eval_steps_per_second": 0.371,
87
+ "step": 900
88
+ },
89
+ {
90
+ "epoch": 8.02,
91
+ "learning_rate": 1.6688918558077437e-05,
92
+ "loss": 1.8138,
93
+ "step": 1000
94
+ },
95
+ {
96
+ "epoch": 8.02,
97
+ "eval_loss": 1.837294340133667,
98
+ "eval_runtime": 75.3775,
99
+ "eval_samples_per_second": 2.945,
100
+ "eval_steps_per_second": 0.371,
101
+ "step": 1000
102
+ },
103
+ {
104
+ "epoch": 8.82,
105
+ "eval_loss": 1.8297418355941772,
106
+ "eval_runtime": 75.4862,
107
+ "eval_samples_per_second": 2.941,
108
+ "eval_steps_per_second": 0.371,
109
+ "step": 1100
110
+ },
111
+ {
112
+ "epoch": 9.62,
113
+ "eval_loss": 1.8239439725875854,
114
+ "eval_runtime": 75.4899,
115
+ "eval_samples_per_second": 2.941,
116
+ "eval_steps_per_second": 0.371,
117
+ "step": 1200
118
+ },
119
+ {
120
+ "epoch": 10.42,
121
+ "eval_loss": 1.8179348707199097,
122
+ "eval_runtime": 75.4662,
123
+ "eval_samples_per_second": 2.942,
124
+ "eval_steps_per_second": 0.371,
125
+ "step": 1300
126
+ },
127
+ {
128
+ "epoch": 11.22,
129
+ "eval_loss": 1.8130933046340942,
130
+ "eval_runtime": 75.5064,
131
+ "eval_samples_per_second": 2.94,
132
+ "eval_steps_per_second": 0.371,
133
+ "step": 1400
134
+ },
135
+ {
136
+ "epoch": 12.02,
137
+ "learning_rate": 1.2516688918558078e-05,
138
+ "loss": 1.7439,
139
+ "step": 1500
140
+ },
141
+ {
142
+ "epoch": 12.02,
143
+ "eval_loss": 1.8075053691864014,
144
+ "eval_runtime": 75.671,
145
+ "eval_samples_per_second": 2.934,
146
+ "eval_steps_per_second": 0.37,
147
+ "step": 1500
148
+ },
149
+ {
150
+ "epoch": 12.83,
151
+ "eval_loss": 1.8044650554656982,
152
+ "eval_runtime": 75.6414,
153
+ "eval_samples_per_second": 2.935,
154
+ "eval_steps_per_second": 0.37,
155
+ "step": 1600
156
+ },
157
+ {
158
+ "epoch": 13.63,
159
+ "eval_loss": 1.8003138303756714,
160
+ "eval_runtime": 75.6422,
161
+ "eval_samples_per_second": 2.935,
162
+ "eval_steps_per_second": 0.37,
163
+ "step": 1700
164
+ },
165
+ {
166
+ "epoch": 14.43,
167
+ "eval_loss": 1.7982312440872192,
168
+ "eval_runtime": 75.6665,
169
+ "eval_samples_per_second": 2.934,
170
+ "eval_steps_per_second": 0.37,
171
+ "step": 1800
172
+ },
173
+ {
174
+ "epoch": 15.23,
175
+ "eval_loss": 1.7970277070999146,
176
+ "eval_runtime": 75.6383,
177
+ "eval_samples_per_second": 2.935,
178
+ "eval_steps_per_second": 0.37,
179
+ "step": 1900
180
+ },
181
+ {
182
+ "epoch": 16.03,
183
+ "learning_rate": 8.344459279038718e-06,
184
+ "loss": 1.7005,
185
+ "step": 2000
186
+ },
187
+ {
188
+ "epoch": 16.03,
189
+ "eval_loss": 1.7927231788635254,
190
+ "eval_runtime": 78.7098,
191
+ "eval_samples_per_second": 2.82,
192
+ "eval_steps_per_second": 0.356,
193
+ "step": 2000
194
+ },
195
+ {
196
+ "epoch": 16.83,
197
+ "eval_loss": 1.790854573249817,
198
+ "eval_runtime": 77.0191,
199
+ "eval_samples_per_second": 2.882,
200
+ "eval_steps_per_second": 0.364,
201
+ "step": 2100
202
+ },
203
+ {
204
+ "epoch": 17.64,
205
+ "eval_loss": 1.7891895771026611,
206
+ "eval_runtime": 76.0084,
207
+ "eval_samples_per_second": 2.921,
208
+ "eval_steps_per_second": 0.368,
209
+ "step": 2200
210
+ },
211
+ {
212
+ "epoch": 18.44,
213
+ "eval_loss": 1.7889128923416138,
214
+ "eval_runtime": 75.6093,
215
+ "eval_samples_per_second": 2.936,
216
+ "eval_steps_per_second": 0.37,
217
+ "step": 2300
218
+ },
219
+ {
220
+ "epoch": 19.24,
221
+ "eval_loss": 1.788590431213379,
222
+ "eval_runtime": 75.7303,
223
+ "eval_samples_per_second": 2.931,
224
+ "eval_steps_per_second": 0.37,
225
+ "step": 2400
226
+ },
227
+ {
228
+ "epoch": 20.04,
229
+ "learning_rate": 4.172229639519359e-06,
230
+ "loss": 1.6705,
231
+ "step": 2500
232
+ },
233
+ {
234
+ "epoch": 20.04,
235
+ "eval_loss": 1.7878992557525635,
236
+ "eval_runtime": 75.5956,
237
+ "eval_samples_per_second": 2.937,
238
+ "eval_steps_per_second": 0.37,
239
+ "step": 2500
240
+ },
241
+ {
242
+ "epoch": 20.84,
243
+ "eval_loss": 1.7869019508361816,
244
+ "eval_runtime": 75.569,
245
+ "eval_samples_per_second": 2.938,
246
+ "eval_steps_per_second": 0.371,
247
+ "step": 2600
248
+ },
249
+ {
250
+ "epoch": 21.64,
251
+ "eval_loss": 1.7858072519302368,
252
+ "eval_runtime": 75.7601,
253
+ "eval_samples_per_second": 2.93,
254
+ "eval_steps_per_second": 0.37,
255
+ "step": 2700
256
+ },
257
+ {
258
+ "epoch": 22.44,
259
+ "eval_loss": 1.7860134840011597,
260
+ "eval_runtime": 75.7457,
261
+ "eval_samples_per_second": 2.931,
262
+ "eval_steps_per_second": 0.37,
263
+ "step": 2800
264
+ }
265
+ ],
266
+ "logging_steps": 500,
267
+ "max_steps": 3000,
268
+ "num_train_epochs": 25,
269
+ "save_steps": 100,
270
+ "total_flos": 3.543009935795159e+18,
271
+ "trial_name": null,
272
+ "trial_params": null
273
+ }
checkpoint-2800/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:43ea1115ffda2a3c1618b3332df716a35be23a2f0189618eee433eae410c93e2
3
+ size 4536
llama2-IPG_finetune_try.ipynb ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 9,
6
+ "metadata": {
7
+ "ExecuteTime": {
8
+ "end_time": "2023-11-25T14:59:03.066893917Z",
9
+ "start_time": "2023-11-25T14:59:02.924638197Z"
10
+ }
11
+ },
12
+ "outputs": [
13
+ {
14
+ "name": "stderr",
15
+ "output_type": "stream",
16
+ "text": [
17
+ "/home/z/miniconda3/envs/llama/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py:472: FutureWarning: The `use_auth_token` argument is deprecated and will be removed in v5 of Transformers. Please use `token` instead.\n",
18
+ " warnings.warn(\n"
19
+ ]
20
+ },
21
+ {
22
+ "data": {
23
+ "application/vnd.jupyter.widget-view+json": {
24
+ "model_id": "6745f1964cda44068721c6c8b5f91eee",
25
+ "version_major": 2,
26
+ "version_minor": 0
27
+ },
28
+ "text/plain": [
29
+ "Loading checkpoint shards: 0%| | 0/3 [00:00<?, ?it/s]"
30
+ ]
31
+ },
32
+ "metadata": {},
33
+ "output_type": "display_data"
34
+ },
35
+ {
36
+ "name": "stderr",
37
+ "output_type": "stream",
38
+ "text": [
39
+ "/home/z/miniconda3/envs/llama/lib/python3.10/site-packages/transformers/utils/hub.py:374: FutureWarning: The `use_auth_token` argument is deprecated and will be removed in v5 of Transformers. Please use `token` instead.\n",
40
+ " warnings.warn(\n"
41
+ ]
42
+ }
43
+ ],
44
+ "source": [
45
+ "import torch\n",
46
+ "from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig\n",
47
+ "\n",
48
+ "# Define the base model ID\n",
49
+ "base_model_id = \"meta-llama/Llama-2-13b-hf\"\n",
50
+ "\n",
51
+ "# Create a BitsAndBytesConfig object with the corrected settings\n",
52
+ "quantization_config = BitsAndBytesConfig(\n",
53
+ " load_in_4bit=True,\n",
54
+ " bnb_4bit_use_double_quant=True,\n",
55
+ " bnb_4bit_quant_type=\"nf4\",\n",
56
+ " bnb_4bit_compute_dtype=torch.bfloat16,\n",
57
+ " load_in_8bit_fp32_cpu_offload=True # Set as suggested in the error\n",
58
+ ")\n",
59
+ "\n",
60
+ "# Load the base model with the updated quantization configuration\n",
61
+ "# Adjust 'device_map' based on your system's GPU configuration\n",
62
+ "base_model = AutoModelForCausalLM.from_pretrained(\n",
63
+ " base_model_id, \n",
64
+ " quantization_config=quantization_config,\n",
65
+ " trust_remote_code=True,\n",
66
+ " use_auth_token=True\n",
67
+ ")\n",
68
+ "\n",
69
+ "# Load the tokenizer\n",
70
+ "tokenizer = AutoTokenizer.from_pretrained(base_model_id, add_bos_token=True, trust_remote_code=True)\n"
71
+ ]
72
+ },
73
+ {
74
+ "cell_type": "markdown",
75
+ "metadata": {
76
+ "id": "_BxOhAiqyRgp"
77
+ },
78
+ "source": [
79
+ "Now load the QLoRA adapter from the appropriate checkpoint directory, i.e. the best performing model checkpoint:"
80
+ ]
81
+ },
82
+ {
83
+ "cell_type": "code",
84
+ "execution_count": 10,
85
+ "metadata": {
86
+ "ExecuteTime": {
87
+ "end_time": "2023-11-25T14:59:12.830783738Z",
88
+ "start_time": "2023-11-25T14:59:12.826615170Z"
89
+ },
90
+ "id": "GwsiqhWuyRgp"
91
+ },
92
+ "outputs": [],
93
+ "source": [
94
+ "from peft import PeftModel\n",
95
+ "\n",
96
+ "ft_model = PeftModel.from_pretrained(base_model, \"checkpoint-2800\")"
97
+ ]
98
+ },
99
+ {
100
+ "cell_type": "code",
101
+ "execution_count": 11,
102
+ "metadata": {},
103
+ "outputs": [],
104
+ "source": [
105
+ "from datasets import load_dataset\n",
106
+ "\n",
107
+ " \n",
108
+ "eval_dataset = load_dataset('json', data_files='/home/z/Music/LLAMA/llama/IPG/datasets/new_test_data.json', split='train')\n",
109
+ "\n",
110
+ "\n",
111
+ "def formatting_func(example):\n",
112
+ " text = f\"### The job description: {example['text']}\\n ### The skills: \"\n",
113
+ " return text\n",
114
+ "\n"
115
+ ]
116
+ },
117
+ {
118
+ "cell_type": "code",
119
+ "execution_count": 12,
120
+ "metadata": {},
121
+ "outputs": [],
122
+ "source": [
123
+ "\n",
124
+ "\n",
125
+ "def run_finetune_model(model_id):\n",
126
+ "\n",
127
+ " example = eval_dataset.filter(lambda x: x['id'] == model_id)[0]\n",
128
+ " formatted_text = formatting_func(example)\n",
129
+ " \n",
130
+ " #print(formatted_text)\n",
131
+ " model_input = tokenizer(formatted_text, return_tensors=\"pt\").to(\"cuda\")\n",
132
+ "\n",
133
+ "\n",
134
+ " ft_model.eval()\n",
135
+ " with torch.no_grad():\n",
136
+ " output_tokens = ft_model.generate(**model_input, max_new_tokens=200)[0]\n",
137
+ " generated_text = tokenizer.decode(output_tokens, skip_special_tokens=True)\n",
138
+ " \n",
139
+ " print(generated_text)\n",
140
+ "\n",
141
+ "\n"
142
+ ]
143
+ },
144
+ {
145
+ "cell_type": "code",
146
+ "execution_count": 13,
147
+ "metadata": {},
148
+ "outputs": [
149
+ {
150
+ "name": "stdout",
151
+ "output_type": "stream",
152
+ "text": [
153
+ "### The job description: German BD Manager\n",
154
+ "Job Description:\n",
155
+ "1、Represent the company to develop new partners for energy storage system;\n",
156
+ "2、Maintain good relationship and help partners to develop/grow the business;\n",
157
+ "3、Formulate a strategy and target for the market exploration so as to achieve good performance;\n",
158
+ "4、Pay attention and collect information for the latest development/tendency in the industry as well as getting feedback/insight to R&D;\n",
159
+ "5、Advice and assist the company to build a strong local team including but not limited to after sale service, technical support, sales and marketing.\n",
160
+ " \n",
161
+ "Job Requirements:\n",
162
+ "1、Fluent in English and German;\n",
163
+ "2、5+ years of experience in the industry of Energy Storage System, a good education background will be preferential;\n",
164
+ "3、Strong execution and result-oriented, attach importance to details and critical thinking as well as desire to progress/evolve;\n",
165
+ "4、Open-minded and teamwork, great skills in communication.\n",
166
+ " ### The skills: ['programming', 'simulation', 'communication', 'excel', 'word', 'powerpoint', 'marketing', 'c++', 'matlab', 'html', 'data analysis', 'powerpoint', 'communication', 'project management', 'excel', 'microsoft office', 'tableau', 'powerpoint', 'word', 'microsoft office', 'communication', 'python', 'excel', 'microsoft office', 'c++', 'python', 'data analysis', 'python', 'html', 'data analysis', 'communication', 'microsoft office', 'java', 'powerpoint']\n",
167
+ " ### The qualifications: \n",
168
+ "\n",
169
+ "\n",
170
+ "\n",
171
+ "\n",
172
+ "\n",
173
+ "\n",
174
+ "\n",
175
+ "\n",
176
+ "\n",
177
+ "\n",
178
+ "\n",
179
+ "\n",
180
+ "\n",
181
+ "\n",
182
+ "\n",
183
+ "\n",
184
+ "\n",
185
+ "\n",
186
+ "\n",
187
+ "\n",
188
+ "\n",
189
+ "\n",
190
+ "\n",
191
+ "\n",
192
+ "\n",
193
+ "\n",
194
+ "\n",
195
+ "\n",
196
+ "\n",
197
+ "\n",
198
+ "\n",
199
+ "\n",
200
+ "\n",
201
+ "\n",
202
+ "\n",
203
+ "\n",
204
+ "\n",
205
+ "\n",
206
+ "\n",
207
+ "\n",
208
+ "\n",
209
+ "\n",
210
+ "\n",
211
+ "\n",
212
+ "\n",
213
+ "\n",
214
+ "\n",
215
+ "\n",
216
+ "\n",
217
+ "\n",
218
+ "\n",
219
+ "\n",
220
+ "\n",
221
+ "\n",
222
+ "\n",
223
+ "\n",
224
+ "\n",
225
+ "\n",
226
+ "\n",
227
+ "\n",
228
+ "\n",
229
+ "\n",
230
+ "\n",
231
+ "\n",
232
+ "\n",
233
+ "\n",
234
+ "\n",
235
+ "\n",
236
+ "\n"
237
+ ]
238
+ }
239
+ ],
240
+ "source": [
241
+ "run_finetune_model(\"19010\")\n"
242
+ ]
243
+ }
244
+ ],
245
+ "metadata": {
246
+ "accelerator": "GPU",
247
+ "colab": {
248
+ "gpuType": "T4",
249
+ "provenance": []
250
+ },
251
+ "gpuClass": "standard",
252
+ "kernelspec": {
253
+ "display_name": "Python 3 (ipykernel)",
254
+ "language": "python",
255
+ "name": "python3"
256
+ },
257
+ "language_info": {
258
+ "codemirror_mode": {
259
+ "name": "ipython",
260
+ "version": 3
261
+ },
262
+ "file_extension": ".py",
263
+ "mimetype": "text/x-python",
264
+ "name": "python",
265
+ "nbconvert_exporter": "python",
266
+ "pygments_lexer": "ipython3",
267
+ "version": "3.10.13"
268
+ }
269
+ },
270
+ "nbformat": 4,
271
+ "nbformat_minor": 4
272
+ }
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ torch
2
+ transformers
3
+ gradio
4
+ peft
uploadmodel.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from huggingface_hub import HfApi, HfFolder
2
+
3
+ # 设置您的Hugging Face用户名和模型名称
4
+
5
+ repo_name = f"wangzerui/Job-Skiils-Analysis"
6
+
7
+ # 获取访问令牌
8
+ token = HfFolder.get_token()
9
+
10
+ # 初始化HfApi
11
+ api = HfApi()
12
+
13
+ # 上传文件到模型仓库
14
+ api.upload_folder(
15
+ folder_path="checkpoint-2800", # 您的模型文件夹路径
16
+ repo_id=repo_name,
17
+ token=token,
18
+ path_in_repo="", # 将模型文件上传到仓库的根目录
19
+ )