KLGR123 commited on
Commit
5f1c52b
1 Parent(s): 336ff50

commit message

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. 202311100214.log +0 -0
  2. README copy.md +58 -0
  3. adapter_config.json +22 -0
  4. adapter_model.bin +3 -0
  5. added_tokens.json +4 -0
  6. all_results.json +7 -0
  7. checkpoint-1000/README.md +207 -0
  8. checkpoint-1000/adapter_config.json +22 -0
  9. checkpoint-1000/adapter_model.bin +3 -0
  10. checkpoint-1000/added_tokens.json +4 -0
  11. checkpoint-1000/optimizer.pt +3 -0
  12. checkpoint-1000/rng_state_0.pth +3 -0
  13. checkpoint-1000/rng_state_1.pth +3 -0
  14. checkpoint-1000/rng_state_2.pth +3 -0
  15. checkpoint-1000/rng_state_3.pth +3 -0
  16. checkpoint-1000/rng_state_4.pth +3 -0
  17. checkpoint-1000/rng_state_5.pth +3 -0
  18. checkpoint-1000/rng_state_6.pth +3 -0
  19. checkpoint-1000/rng_state_7.pth +3 -0
  20. checkpoint-1000/scheduler.pt +3 -0
  21. checkpoint-1000/special_tokens_map.json +6 -0
  22. checkpoint-1000/tokenization_chatglm.py +283 -0
  23. checkpoint-1000/tokenizer.model +3 -0
  24. checkpoint-1000/tokenizer_config.json +38 -0
  25. checkpoint-1000/trainer_state.json +619 -0
  26. checkpoint-1000/training_args.bin +3 -0
  27. checkpoint-1200/README.md +207 -0
  28. checkpoint-1200/adapter_config.json +22 -0
  29. checkpoint-1200/adapter_model.bin +3 -0
  30. checkpoint-1200/added_tokens.json +4 -0
  31. checkpoint-1200/optimizer.pt +3 -0
  32. checkpoint-1200/rng_state_0.pth +3 -0
  33. checkpoint-1200/rng_state_1.pth +3 -0
  34. checkpoint-1200/rng_state_2.pth +3 -0
  35. checkpoint-1200/rng_state_3.pth +3 -0
  36. checkpoint-1200/rng_state_4.pth +3 -0
  37. checkpoint-1200/rng_state_5.pth +3 -0
  38. checkpoint-1200/rng_state_6.pth +3 -0
  39. checkpoint-1200/rng_state_7.pth +3 -0
  40. checkpoint-1200/scheduler.pt +3 -0
  41. checkpoint-1200/special_tokens_map.json +6 -0
  42. checkpoint-1200/tokenization_chatglm.py +283 -0
  43. checkpoint-1200/tokenizer.model +3 -0
  44. checkpoint-1200/tokenizer_config.json +38 -0
  45. checkpoint-1200/trainer_state.json +739 -0
  46. checkpoint-1200/training_args.bin +3 -0
  47. checkpoint-1400/README.md +207 -0
  48. checkpoint-1400/adapter_config.json +22 -0
  49. checkpoint-1400/adapter_model.bin +3 -0
  50. checkpoint-1400/added_tokens.json +4 -0
202311100214.log ADDED
The diff for this file is too large to render. See raw diff
 
README copy.md ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: /home/hz/projects/chatglm3-6b-32k
3
+ tags:
4
+ - llama-factory
5
+ - lora
6
+ - generated_from_trainer
7
+ model-index:
8
+ - name: chatglm3-6b-32k-wenshu-finetuned
9
+ results: []
10
+ ---
11
+
12
+ <!-- This model card has been generated automatically according to the information the Trainer had access to. You
13
+ should probably proofread and complete it, then remove this comment. -->
14
+
15
+ # chatglm3-6b-32k-wenshu-finetuned
16
+
17
+ This model is a fine-tuned version of [/home/hz/projects/chatglm3-6b-32k](https://huggingface.co//home/hz/projects/chatglm3-6b-32k) on the wenshu_dataset dataset.
18
+
19
+ ## Model description
20
+
21
+ More information needed
22
+
23
+ ## Intended uses & limitations
24
+
25
+ More information needed
26
+
27
+ ## Training and evaluation data
28
+
29
+ More information needed
30
+
31
+ ## Training procedure
32
+
33
+ ### Training hyperparameters
34
+
35
+ The following hyperparameters were used during training:
36
+ - learning_rate: 5e-05
37
+ - train_batch_size: 4
38
+ - eval_batch_size: 8
39
+ - seed: 42
40
+ - distributed_type: multi-GPU
41
+ - num_devices: 8
42
+ - gradient_accumulation_steps: 8
43
+ - total_train_batch_size: 256
44
+ - total_eval_batch_size: 64
45
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
46
+ - lr_scheduler_type: cosine
47
+ - num_epochs: 3.0
48
+
49
+ ### Training results
50
+
51
+
52
+
53
+ ### Framework versions
54
+
55
+ - Transformers 4.34.0
56
+ - Pytorch 2.0.1+cu117
57
+ - Datasets 2.14.6
58
+ - Tokenizers 0.14.1
adapter_config.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "/home/hz/projects/chatglm3-6b-32k",
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": 32.0,
12
+ "lora_dropout": 0.1,
13
+ "modules_to_save": null,
14
+ "peft_type": "LORA",
15
+ "r": 8,
16
+ "rank_pattern": {},
17
+ "revision": null,
18
+ "target_modules": [
19
+ "query_key_value"
20
+ ],
21
+ "task_type": "CAUSAL_LM"
22
+ }
adapter_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c3346e13155c0d39280e75d07fe63bd525777020def5c6512c3907aaea14da10
3
+ size 7820185
added_tokens.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "<|observation|>": 64797,
3
+ "<|user|>": 64795
4
+ }
all_results.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 3.0,
3
+ "train_loss": 0.40742741023141216,
4
+ "train_runtime": 104521.3326,
5
+ "train_samples_per_second": 10.964,
6
+ "train_steps_per_second": 0.043
7
+ }
checkpoint-1000/README.md ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: peft
3
+ base_model: /home/hz/projects/chatglm3-6b-32k
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
+ ### Framework versions
205
+
206
+
207
+ - PEFT 0.6.1
checkpoint-1000/adapter_config.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "/home/hz/projects/chatglm3-6b-32k",
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": 32.0,
12
+ "lora_dropout": 0.1,
13
+ "modules_to_save": null,
14
+ "peft_type": "LORA",
15
+ "r": 8,
16
+ "rank_pattern": {},
17
+ "revision": null,
18
+ "target_modules": [
19
+ "query_key_value"
20
+ ],
21
+ "task_type": "CAUSAL_LM"
22
+ }
checkpoint-1000/adapter_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3342fe0de43a1853b1fdaad882567a452ec747c7bb392a7e5e2a88c0a939cc11
3
+ size 7820185
checkpoint-1000/added_tokens.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "<|observation|>": 64797,
3
+ "<|user|>": 64795
4
+ }
checkpoint-1000/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f3badd333c7c2ea3bb2494882b036831b3692efddb08fe380c12ae793f7d5d63
3
+ size 15644485
checkpoint-1000/rng_state_0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1060624c7954c3b286c1948a1dd5e1ce39c497aee826b7f77f55576e5309b4c3
3
+ size 21687
checkpoint-1000/rng_state_1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:28602630f9bf652c63fca7559b6f34e3236d16cb19a88e14b1ae9abc3f89b7c6
3
+ size 21687
checkpoint-1000/rng_state_2.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:331d1c16c6e5f215989b0d4f6f031cadc6c60d030a502ce8c93d000b402b8ad4
3
+ size 21687
checkpoint-1000/rng_state_3.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:36b8b18dff0d9c7fa865aa16e2d89c59d88fad7d0bc2a1589c8a7cd422051ac8
3
+ size 21687
checkpoint-1000/rng_state_4.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e607493ac32d6d104991335c8909b9165d6475b6001cfd544a15a014fb21aaef
3
+ size 21687
checkpoint-1000/rng_state_5.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f91e8dbba9f0531a6db2b77df4458c926e4f57aa448d6fc5ef1918429d742736
3
+ size 21687
checkpoint-1000/rng_state_6.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:34901406783e82c1f339065211640375722456aa206f399ee541b75f44a6a3a1
3
+ size 21687
checkpoint-1000/rng_state_7.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:22decdcd459d4cbd6fb83a5afd8d9e6edec7ee066069d318782fde025ca4c4de
3
+ size 21687
checkpoint-1000/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:707b10eb98685e357773ca2125e0d6c1c1de2a1c4e7ededd34ea00989b0b159a
3
+ size 627
checkpoint-1000/special_tokens_map.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|user|>",
4
+ "<|observation|>"
5
+ ]
6
+ }
checkpoint-1000/tokenization_chatglm.py ADDED
@@ -0,0 +1,283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import os
3
+ import torch
4
+ from typing import List, Optional, Union, Dict
5
+ from sentencepiece import SentencePieceProcessor
6
+ from transformers import PreTrainedTokenizer
7
+ from transformers.utils import logging, PaddingStrategy
8
+ from transformers.tokenization_utils_base import EncodedInput, BatchEncoding
9
+
10
+
11
+ class SPTokenizer:
12
+ def __init__(self, model_path: str):
13
+ # reload tokenizer
14
+ assert os.path.isfile(model_path), model_path
15
+ self.sp_model = SentencePieceProcessor(model_file=model_path)
16
+
17
+ # BOS / EOS token IDs
18
+ self.n_words: int = self.sp_model.vocab_size()
19
+ self.bos_id: int = self.sp_model.bos_id()
20
+ self.eos_id: int = self.sp_model.eos_id()
21
+ self.pad_id: int = self.sp_model.unk_id()
22
+ assert self.sp_model.vocab_size() == self.sp_model.get_piece_size()
23
+
24
+ special_tokens = ["[MASK]", "[gMASK]", "[sMASK]", "sop", "eop", "<|system|>", "<|user|>", "<|assistant|>",
25
+ "<|observation|>"]
26
+ self.special_tokens = {}
27
+ self.index_special_tokens = {}
28
+ for token in special_tokens:
29
+ self.special_tokens[token] = self.n_words
30
+ self.index_special_tokens[self.n_words] = token
31
+ self.n_words += 1
32
+
33
+ def tokenize(self, s: str):
34
+ return self.sp_model.EncodeAsPieces(s)
35
+
36
+ def encode(self, s: str, bos: bool = False, eos: bool = False) -> List[int]:
37
+ assert type(s) is str
38
+ t = self.sp_model.encode(s)
39
+ if bos:
40
+ t = [self.bos_id] + t
41
+ if eos:
42
+ t = t + [self.eos_id]
43
+ return t
44
+
45
+ def decode(self, t: List[int]) -> str:
46
+ text, buffer = "", []
47
+ for token in t:
48
+ if token in self.index_special_tokens:
49
+ if buffer:
50
+ text += self.sp_model.decode(buffer)
51
+ buffer = []
52
+ text += self.index_special_tokens[token]
53
+ else:
54
+ buffer.append(token)
55
+ if buffer:
56
+ text += self.sp_model.decode(buffer)
57
+ return text
58
+
59
+ def decode_tokens(self, tokens: List[str]) -> str:
60
+ text = self.sp_model.DecodePieces(tokens)
61
+ return text
62
+
63
+ def convert_token_to_id(self, token):
64
+ """ Converts a token (str) in an id using the vocab. """
65
+ if token in self.special_tokens:
66
+ return self.special_tokens[token]
67
+ return self.sp_model.PieceToId(token)
68
+
69
+ def convert_id_to_token(self, index):
70
+ """Converts an index (integer) in a token (str) using the vocab."""
71
+ if index in self.index_special_tokens:
72
+ return self.index_special_tokens[index]
73
+ if index in [self.eos_id, self.bos_id, self.pad_id] or index < 0:
74
+ return ""
75
+ return self.sp_model.IdToPiece(index)
76
+
77
+
78
+ class ChatGLMTokenizer(PreTrainedTokenizer):
79
+ vocab_files_names = {"vocab_file": "tokenizer.model"}
80
+
81
+ model_input_names = ["input_ids", "attention_mask", "position_ids"]
82
+
83
+ def __init__(self, vocab_file, padding_side="left", clean_up_tokenization_spaces=False, **kwargs):
84
+ self.name = "GLMTokenizer"
85
+
86
+ self.vocab_file = vocab_file
87
+ self.tokenizer = SPTokenizer(vocab_file)
88
+ self.special_tokens = {
89
+ "<bos>": self.tokenizer.bos_id,
90
+ "<eos>": self.tokenizer.eos_id,
91
+ "<pad>": self.tokenizer.pad_id
92
+ }
93
+ super().__init__(padding_side=padding_side, clean_up_tokenization_spaces=clean_up_tokenization_spaces, **kwargs)
94
+
95
+ def get_command(self, token):
96
+ if token in self.special_tokens:
97
+ return self.special_tokens[token]
98
+ assert token in self.tokenizer.special_tokens, f"{token} is not a special token for {self.name}"
99
+ return self.tokenizer.special_tokens[token]
100
+
101
+ @property
102
+ def unk_token(self) -> str:
103
+ return "<unk>"
104
+
105
+ @property
106
+ def pad_token(self) -> str:
107
+ return "<unk>"
108
+
109
+ @property
110
+ def pad_token_id(self):
111
+ return self.get_command("<pad>")
112
+
113
+ @property
114
+ def eos_token(self) -> str:
115
+ return "</s>"
116
+
117
+ @property
118
+ def eos_token_id(self):
119
+ return self.get_command("<eos>")
120
+
121
+ @property
122
+ def vocab_size(self):
123
+ return self.tokenizer.n_words
124
+
125
+ def get_vocab(self):
126
+ """ Returns vocab as a dict """
127
+ vocab = {self._convert_id_to_token(i): i for i in range(self.vocab_size)}
128
+ vocab.update(self.added_tokens_encoder)
129
+ return vocab
130
+
131
+ def _tokenize(self, text, **kwargs):
132
+ return self.tokenizer.tokenize(text)
133
+
134
+ def _convert_token_to_id(self, token):
135
+ """ Converts a token (str) in an id using the vocab. """
136
+ return self.tokenizer.convert_token_to_id(token)
137
+
138
+ def _convert_id_to_token(self, index):
139
+ """Converts an index (integer) in a token (str) using the vocab."""
140
+ return self.tokenizer.convert_id_to_token(index)
141
+
142
+ def convert_tokens_to_string(self, tokens: List[str]) -> str:
143
+ return self.tokenizer.decode_tokens(tokens)
144
+
145
+ def save_vocabulary(self, save_directory, filename_prefix=None):
146
+ """
147
+ Save the vocabulary and special tokens file to a directory.
148
+
149
+ Args:
150
+ save_directory (`str`):
151
+ The directory in which to save the vocabulary.
152
+ filename_prefix (`str`, *optional*):
153
+ An optional prefix to add to the named of the saved files.
154
+
155
+ Returns:
156
+ `Tuple(str)`: Paths to the files saved.
157
+ """
158
+ if os.path.isdir(save_directory):
159
+ vocab_file = os.path.join(
160
+ save_directory, self.vocab_files_names["vocab_file"]
161
+ )
162
+ else:
163
+ vocab_file = save_directory
164
+
165
+ with open(self.vocab_file, 'rb') as fin:
166
+ proto_str = fin.read()
167
+
168
+ with open(vocab_file, "wb") as writer:
169
+ writer.write(proto_str)
170
+
171
+ return (vocab_file,)
172
+
173
+ def get_prefix_tokens(self):
174
+ prefix_tokens = [self.get_command("[gMASK]"), self.get_command("sop")]
175
+ return prefix_tokens
176
+
177
+ def build_single_message(self, role, metadata, message):
178
+ assert role in ["system", "user", "assistant", "observation"], role
179
+ role_tokens = [self.get_command(f"<|{role}|>")] + self.tokenizer.encode(f"{metadata}\n")
180
+ message_tokens = self.tokenizer.encode(message)
181
+ tokens = role_tokens + message_tokens
182
+ return tokens
183
+
184
+ def build_chat_input(self, query, history=None, role="user"):
185
+ if history is None:
186
+ history = []
187
+ input_ids = []
188
+ for item in history:
189
+ content = item["content"]
190
+ if item["role"] == "system" and "tools" in item:
191
+ content = content + "\n" + json.dumps(item["tools"], indent=4, ensure_ascii=False)
192
+ input_ids.extend(self.build_single_message(item["role"], item.get("metadata", ""), content))
193
+ input_ids.extend(self.build_single_message(role, "", query))
194
+ input_ids.extend([self.get_command("<|assistant|>")])
195
+ return self.batch_encode_plus([input_ids], return_tensors="pt", is_split_into_words=True)
196
+
197
+ def build_inputs_with_special_tokens(
198
+ self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None
199
+ ) -> List[int]:
200
+ """
201
+ Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
202
+ adding special tokens. A BERT sequence has the following format:
203
+
204
+ - single sequence: `[CLS] X [SEP]`
205
+ - pair of sequences: `[CLS] A [SEP] B [SEP]`
206
+
207
+ Args:
208
+ token_ids_0 (`List[int]`):
209
+ List of IDs to which the special tokens will be added.
210
+ token_ids_1 (`List[int]`, *optional*):
211
+ Optional second list of IDs for sequence pairs.
212
+
213
+ Returns:
214
+ `List[int]`: List of [input IDs](../glossary#input-ids) with the appropriate special tokens.
215
+ """
216
+ prefix_tokens = self.get_prefix_tokens()
217
+ token_ids_0 = prefix_tokens + token_ids_0
218
+ if token_ids_1 is not None:
219
+ token_ids_0 = token_ids_0 + token_ids_1 + [self.get_command("<eos>")]
220
+ return token_ids_0
221
+
222
+ def _pad(
223
+ self,
224
+ encoded_inputs: Union[Dict[str, EncodedInput], BatchEncoding],
225
+ max_length: Optional[int] = None,
226
+ padding_strategy: PaddingStrategy = PaddingStrategy.DO_NOT_PAD,
227
+ pad_to_multiple_of: Optional[int] = None,
228
+ return_attention_mask: Optional[bool] = None,
229
+ ) -> dict:
230
+ """
231
+ Pad encoded inputs (on left/right and up to predefined length or max length in the batch)
232
+
233
+ Args:
234
+ encoded_inputs:
235
+ Dictionary of tokenized inputs (`List[int]`) or batch of tokenized inputs (`List[List[int]]`).
236
+ max_length: maximum length of the returned list and optionally padding length (see below).
237
+ Will truncate by taking into account the special tokens.
238
+ padding_strategy: PaddingStrategy to use for padding.
239
+
240
+ - PaddingStrategy.LONGEST Pad to the longest sequence in the batch
241
+ - PaddingStrategy.MAX_LENGTH: Pad to the max length (default)
242
+ - PaddingStrategy.DO_NOT_PAD: Do not pad
243
+ The tokenizer padding sides are defined in self.padding_side:
244
+
245
+ - 'left': pads on the left of the sequences
246
+ - 'right': pads on the right of the sequences
247
+ pad_to_multiple_of: (optional) Integer if set will pad the sequence to a multiple of the provided value.
248
+ This is especially useful to enable the use of Tensor Core on NVIDIA hardware with compute capability
249
+ `>= 7.5` (Volta).
250
+ return_attention_mask:
251
+ (optional) Set to False to avoid returning attention mask (default: set to model specifics)
252
+ """
253
+ # Load from model defaults
254
+ assert self.padding_side == "left"
255
+
256
+ required_input = encoded_inputs[self.model_input_names[0]]
257
+ seq_length = len(required_input)
258
+
259
+ if padding_strategy == PaddingStrategy.LONGEST:
260
+ max_length = len(required_input)
261
+
262
+ if max_length is not None and pad_to_multiple_of is not None and (max_length % pad_to_multiple_of != 0):
263
+ max_length = ((max_length // pad_to_multiple_of) + 1) * pad_to_multiple_of
264
+
265
+ needs_to_be_padded = padding_strategy != PaddingStrategy.DO_NOT_PAD and len(required_input) != max_length
266
+
267
+ # Initialize attention mask if not present.
268
+ if "attention_mask" not in encoded_inputs:
269
+ encoded_inputs["attention_mask"] = [1] * seq_length
270
+
271
+ if "position_ids" not in encoded_inputs:
272
+ encoded_inputs["position_ids"] = list(range(seq_length))
273
+
274
+ if needs_to_be_padded:
275
+ difference = max_length - len(required_input)
276
+
277
+ if "attention_mask" in encoded_inputs:
278
+ encoded_inputs["attention_mask"] = [0] * difference + encoded_inputs["attention_mask"]
279
+ if "position_ids" in encoded_inputs:
280
+ encoded_inputs["position_ids"] = [0] * difference + encoded_inputs["position_ids"]
281
+ encoded_inputs[self.model_input_names[0]] = [self.pad_token_id] * difference + required_input
282
+
283
+ return encoded_inputs
checkpoint-1000/tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e7dc4c393423b76e4373e5157ddc34803a0189ba96b21ddbb40269d31468a6f2
3
+ size 1018370
checkpoint-1000/tokenizer_config.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "64795": {
4
+ "content": "<|user|>",
5
+ "lstrip": true,
6
+ "normalized": false,
7
+ "rstrip": true,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "64797": {
12
+ "content": "<|observation|>",
13
+ "lstrip": true,
14
+ "normalized": false,
15
+ "rstrip": true,
16
+ "single_word": false,
17
+ "special": true
18
+ }
19
+ },
20
+ "additional_special_tokens": [
21
+ "<|user|>",
22
+ "<|observation|>"
23
+ ],
24
+ "auto_map": {
25
+ "AutoTokenizer": [
26
+ "tokenization_chatglm.ChatGLMTokenizer",
27
+ null
28
+ ]
29
+ },
30
+ "clean_up_tokenization_spaces": false,
31
+ "do_lower_case": false,
32
+ "model_max_length": 1000000000000000019884624838656,
33
+ "padding_side": "right",
34
+ "remove_space": false,
35
+ "split_special_tokens": false,
36
+ "tokenizer_class": "ChatGLMTokenizer",
37
+ "tokenizer_file": null
38
+ }
checkpoint-1000/trainer_state.json ADDED
@@ -0,0 +1,619 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 0.6701289998324678,
5
+ "eval_steps": 500,
6
+ "global_step": 1000,
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.01,
13
+ "learning_rate": 4.99993842168232e-05,
14
+ "loss": 1.2211,
15
+ "step": 10
16
+ },
17
+ {
18
+ "epoch": 0.01,
19
+ "learning_rate": 4.9997536897627915e-05,
20
+ "loss": 1.0276,
21
+ "step": 20
22
+ },
23
+ {
24
+ "epoch": 0.02,
25
+ "learning_rate": 4.9994458133418e-05,
26
+ "loss": 0.8587,
27
+ "step": 30
28
+ },
29
+ {
30
+ "epoch": 0.03,
31
+ "learning_rate": 4.999014807586154e-05,
32
+ "loss": 0.7431,
33
+ "step": 40
34
+ },
35
+ {
36
+ "epoch": 0.03,
37
+ "learning_rate": 4.9984606937283405e-05,
38
+ "loss": 0.6841,
39
+ "step": 50
40
+ },
41
+ {
42
+ "epoch": 0.04,
43
+ "learning_rate": 4.9977834990654804e-05,
44
+ "loss": 0.6452,
45
+ "step": 60
46
+ },
47
+ {
48
+ "epoch": 0.05,
49
+ "learning_rate": 4.99698325695798e-05,
50
+ "loss": 0.6347,
51
+ "step": 70
52
+ },
53
+ {
54
+ "epoch": 0.05,
55
+ "learning_rate": 4.9960600068278876e-05,
56
+ "loss": 0.6109,
57
+ "step": 80
58
+ },
59
+ {
60
+ "epoch": 0.06,
61
+ "learning_rate": 4.995013794156957e-05,
62
+ "loss": 0.5911,
63
+ "step": 90
64
+ },
65
+ {
66
+ "epoch": 0.07,
67
+ "learning_rate": 4.993844670484401e-05,
68
+ "loss": 0.5803,
69
+ "step": 100
70
+ },
71
+ {
72
+ "epoch": 0.07,
73
+ "learning_rate": 4.992552693404354e-05,
74
+ "loss": 0.5902,
75
+ "step": 110
76
+ },
77
+ {
78
+ "epoch": 0.08,
79
+ "learning_rate": 4.991137926563036e-05,
80
+ "loss": 0.5745,
81
+ "step": 120
82
+ },
83
+ {
84
+ "epoch": 0.09,
85
+ "learning_rate": 4.9896004396556176e-05,
86
+ "loss": 0.5538,
87
+ "step": 130
88
+ },
89
+ {
90
+ "epoch": 0.09,
91
+ "learning_rate": 4.987940308422783e-05,
92
+ "loss": 0.5495,
93
+ "step": 140
94
+ },
95
+ {
96
+ "epoch": 0.1,
97
+ "learning_rate": 4.986157614647005e-05,
98
+ "loss": 0.5433,
99
+ "step": 150
100
+ },
101
+ {
102
+ "epoch": 0.11,
103
+ "learning_rate": 4.984252446148508e-05,
104
+ "loss": 0.548,
105
+ "step": 160
106
+ },
107
+ {
108
+ "epoch": 0.11,
109
+ "learning_rate": 4.98222489678095e-05,
110
+ "loss": 0.5361,
111
+ "step": 170
112
+ },
113
+ {
114
+ "epoch": 0.12,
115
+ "learning_rate": 4.980075066426796e-05,
116
+ "loss": 0.5331,
117
+ "step": 180
118
+ },
119
+ {
120
+ "epoch": 0.13,
121
+ "learning_rate": 4.977803060992393e-05,
122
+ "loss": 0.53,
123
+ "step": 190
124
+ },
125
+ {
126
+ "epoch": 0.13,
127
+ "learning_rate": 4.97540899240276e-05,
128
+ "loss": 0.5135,
129
+ "step": 200
130
+ },
131
+ {
132
+ "epoch": 0.14,
133
+ "learning_rate": 4.972892978596069e-05,
134
+ "loss": 0.5101,
135
+ "step": 210
136
+ },
137
+ {
138
+ "epoch": 0.15,
139
+ "learning_rate": 4.970255143517838e-05,
140
+ "loss": 0.5125,
141
+ "step": 220
142
+ },
143
+ {
144
+ "epoch": 0.15,
145
+ "learning_rate": 4.967495617114826e-05,
146
+ "loss": 0.4928,
147
+ "step": 230
148
+ },
149
+ {
150
+ "epoch": 0.16,
151
+ "learning_rate": 4.964614535328626e-05,
152
+ "loss": 0.4878,
153
+ "step": 240
154
+ },
155
+ {
156
+ "epoch": 0.17,
157
+ "learning_rate": 4.961612040088973e-05,
158
+ "loss": 0.5017,
159
+ "step": 250
160
+ },
161
+ {
162
+ "epoch": 0.17,
163
+ "learning_rate": 4.9584882793067534e-05,
164
+ "loss": 0.4863,
165
+ "step": 260
166
+ },
167
+ {
168
+ "epoch": 0.18,
169
+ "learning_rate": 4.955243406866713e-05,
170
+ "loss": 0.4847,
171
+ "step": 270
172
+ },
173
+ {
174
+ "epoch": 0.19,
175
+ "learning_rate": 4.951877582619881e-05,
176
+ "loss": 0.4868,
177
+ "step": 280
178
+ },
179
+ {
180
+ "epoch": 0.19,
181
+ "learning_rate": 4.948390972375694e-05,
182
+ "loss": 0.4748,
183
+ "step": 290
184
+ },
185
+ {
186
+ "epoch": 0.2,
187
+ "learning_rate": 4.944783747893825e-05,
188
+ "loss": 0.4764,
189
+ "step": 300
190
+ },
191
+ {
192
+ "epoch": 0.21,
193
+ "learning_rate": 4.941056086875727e-05,
194
+ "loss": 0.4712,
195
+ "step": 310
196
+ },
197
+ {
198
+ "epoch": 0.21,
199
+ "learning_rate": 4.937208172955876e-05,
200
+ "loss": 0.4642,
201
+ "step": 320
202
+ },
203
+ {
204
+ "epoch": 0.22,
205
+ "learning_rate": 4.9332401956927224e-05,
206
+ "loss": 0.4642,
207
+ "step": 330
208
+ },
209
+ {
210
+ "epoch": 0.23,
211
+ "learning_rate": 4.9291523505593604e-05,
212
+ "loss": 0.4709,
213
+ "step": 340
214
+ },
215
+ {
216
+ "epoch": 0.23,
217
+ "learning_rate": 4.9249448389338905e-05,
218
+ "loss": 0.461,
219
+ "step": 350
220
+ },
221
+ {
222
+ "epoch": 0.24,
223
+ "learning_rate": 4.920617868089501e-05,
224
+ "loss": 0.4677,
225
+ "step": 360
226
+ },
227
+ {
228
+ "epoch": 0.25,
229
+ "learning_rate": 4.9161716511842614e-05,
230
+ "loss": 0.4564,
231
+ "step": 370
232
+ },
233
+ {
234
+ "epoch": 0.25,
235
+ "learning_rate": 4.911606407250617e-05,
236
+ "loss": 0.4663,
237
+ "step": 380
238
+ },
239
+ {
240
+ "epoch": 0.26,
241
+ "learning_rate": 4.9069223611846014e-05,
242
+ "loss": 0.4682,
243
+ "step": 390
244
+ },
245
+ {
246
+ "epoch": 0.27,
247
+ "learning_rate": 4.9021197437347555e-05,
248
+ "loss": 0.4636,
249
+ "step": 400
250
+ },
251
+ {
252
+ "epoch": 0.27,
253
+ "learning_rate": 4.897198791490762e-05,
254
+ "loss": 0.4569,
255
+ "step": 410
256
+ },
257
+ {
258
+ "epoch": 0.28,
259
+ "learning_rate": 4.8921597468717887e-05,
260
+ "loss": 0.462,
261
+ "step": 420
262
+ },
263
+ {
264
+ "epoch": 0.29,
265
+ "learning_rate": 4.887002858114548e-05,
266
+ "loss": 0.4563,
267
+ "step": 430
268
+ },
269
+ {
270
+ "epoch": 0.29,
271
+ "learning_rate": 4.881728379261068e-05,
272
+ "loss": 0.4563,
273
+ "step": 440
274
+ },
275
+ {
276
+ "epoch": 0.3,
277
+ "learning_rate": 4.876336570146175e-05,
278
+ "loss": 0.4468,
279
+ "step": 450
280
+ },
281
+ {
282
+ "epoch": 0.31,
283
+ "learning_rate": 4.870827696384698e-05,
284
+ "loss": 0.4508,
285
+ "step": 460
286
+ },
287
+ {
288
+ "epoch": 0.31,
289
+ "learning_rate": 4.865202029358379e-05,
290
+ "loss": 0.4507,
291
+ "step": 470
292
+ },
293
+ {
294
+ "epoch": 0.32,
295
+ "learning_rate": 4.859459846202507e-05,
296
+ "loss": 0.4486,
297
+ "step": 480
298
+ },
299
+ {
300
+ "epoch": 0.33,
301
+ "learning_rate": 4.853601429792265e-05,
302
+ "loss": 0.4423,
303
+ "step": 490
304
+ },
305
+ {
306
+ "epoch": 0.34,
307
+ "learning_rate": 4.847627068728795e-05,
308
+ "loss": 0.4369,
309
+ "step": 500
310
+ },
311
+ {
312
+ "epoch": 0.34,
313
+ "learning_rate": 4.841537057324979e-05,
314
+ "loss": 0.4429,
315
+ "step": 510
316
+ },
317
+ {
318
+ "epoch": 0.35,
319
+ "learning_rate": 4.835331695590943e-05,
320
+ "loss": 0.4389,
321
+ "step": 520
322
+ },
323
+ {
324
+ "epoch": 0.36,
325
+ "learning_rate": 4.829011289219276e-05,
326
+ "loss": 0.44,
327
+ "step": 530
328
+ },
329
+ {
330
+ "epoch": 0.36,
331
+ "learning_rate": 4.82257614956997e-05,
332
+ "loss": 0.4476,
333
+ "step": 540
334
+ },
335
+ {
336
+ "epoch": 0.37,
337
+ "learning_rate": 4.816026593655085e-05,
338
+ "loss": 0.4367,
339
+ "step": 550
340
+ },
341
+ {
342
+ "epoch": 0.38,
343
+ "learning_rate": 4.809362944123129e-05,
344
+ "loss": 0.4357,
345
+ "step": 560
346
+ },
347
+ {
348
+ "epoch": 0.38,
349
+ "learning_rate": 4.802585529243164e-05,
350
+ "loss": 0.4492,
351
+ "step": 570
352
+ },
353
+ {
354
+ "epoch": 0.39,
355
+ "learning_rate": 4.795694682888635e-05,
356
+ "loss": 0.4403,
357
+ "step": 580
358
+ },
359
+ {
360
+ "epoch": 0.4,
361
+ "learning_rate": 4.7886907445209234e-05,
362
+ "loss": 0.4406,
363
+ "step": 590
364
+ },
365
+ {
366
+ "epoch": 0.4,
367
+ "learning_rate": 4.781574059172621e-05,
368
+ "loss": 0.4317,
369
+ "step": 600
370
+ },
371
+ {
372
+ "epoch": 0.41,
373
+ "learning_rate": 4.7743449774305386e-05,
374
+ "loss": 0.4379,
375
+ "step": 610
376
+ },
377
+ {
378
+ "epoch": 0.42,
379
+ "learning_rate": 4.7670038554184296e-05,
380
+ "loss": 0.4324,
381
+ "step": 620
382
+ },
383
+ {
384
+ "epoch": 0.42,
385
+ "learning_rate": 4.7595510547794465e-05,
386
+ "loss": 0.4329,
387
+ "step": 630
388
+ },
389
+ {
390
+ "epoch": 0.43,
391
+ "learning_rate": 4.751986942658332e-05,
392
+ "loss": 0.4259,
393
+ "step": 640
394
+ },
395
+ {
396
+ "epoch": 0.44,
397
+ "learning_rate": 4.744311891683325e-05,
398
+ "loss": 0.4256,
399
+ "step": 650
400
+ },
401
+ {
402
+ "epoch": 0.44,
403
+ "learning_rate": 4.736526279947807e-05,
404
+ "loss": 0.4289,
405
+ "step": 660
406
+ },
407
+ {
408
+ "epoch": 0.45,
409
+ "learning_rate": 4.728630490991676e-05,
410
+ "loss": 0.4353,
411
+ "step": 670
412
+ },
413
+ {
414
+ "epoch": 0.46,
415
+ "learning_rate": 4.7206249137824535e-05,
416
+ "loss": 0.4413,
417
+ "step": 680
418
+ },
419
+ {
420
+ "epoch": 0.46,
421
+ "learning_rate": 4.7125099426961185e-05,
422
+ "loss": 0.4302,
423
+ "step": 690
424
+ },
425
+ {
426
+ "epoch": 0.47,
427
+ "learning_rate": 4.704285977497687e-05,
428
+ "loss": 0.4365,
429
+ "step": 700
430
+ },
431
+ {
432
+ "epoch": 0.48,
433
+ "learning_rate": 4.6959534233215116e-05,
434
+ "loss": 0.4238,
435
+ "step": 710
436
+ },
437
+ {
438
+ "epoch": 0.48,
439
+ "learning_rate": 4.687512690651328e-05,
440
+ "loss": 0.4284,
441
+ "step": 720
442
+ },
443
+ {
444
+ "epoch": 0.49,
445
+ "learning_rate": 4.678964195300028e-05,
446
+ "loss": 0.4193,
447
+ "step": 730
448
+ },
449
+ {
450
+ "epoch": 0.5,
451
+ "learning_rate": 4.670308358389184e-05,
452
+ "loss": 0.4256,
453
+ "step": 740
454
+ },
455
+ {
456
+ "epoch": 0.5,
457
+ "learning_rate": 4.6615456063282944e-05,
458
+ "loss": 0.4288,
459
+ "step": 750
460
+ },
461
+ {
462
+ "epoch": 0.51,
463
+ "learning_rate": 4.652676370793784e-05,
464
+ "loss": 0.4335,
465
+ "step": 760
466
+ },
467
+ {
468
+ "epoch": 0.52,
469
+ "learning_rate": 4.643701088707736e-05,
470
+ "loss": 0.4271,
471
+ "step": 770
472
+ },
473
+ {
474
+ "epoch": 0.52,
475
+ "learning_rate": 4.634620202216366e-05,
476
+ "loss": 0.4304,
477
+ "step": 780
478
+ },
479
+ {
480
+ "epoch": 0.53,
481
+ "learning_rate": 4.625434158668246e-05,
482
+ "loss": 0.4249,
483
+ "step": 790
484
+ },
485
+ {
486
+ "epoch": 0.54,
487
+ "learning_rate": 4.6161434105922616e-05,
488
+ "loss": 0.4322,
489
+ "step": 800
490
+ },
491
+ {
492
+ "epoch": 0.54,
493
+ "learning_rate": 4.6067484156753234e-05,
494
+ "loss": 0.4229,
495
+ "step": 810
496
+ },
497
+ {
498
+ "epoch": 0.55,
499
+ "learning_rate": 4.597249636739815e-05,
500
+ "loss": 0.4252,
501
+ "step": 820
502
+ },
503
+ {
504
+ "epoch": 0.56,
505
+ "learning_rate": 4.5876475417207974e-05,
506
+ "loss": 0.413,
507
+ "step": 830
508
+ },
509
+ {
510
+ "epoch": 0.56,
511
+ "learning_rate": 4.577942603642959e-05,
512
+ "loss": 0.4186,
513
+ "step": 840
514
+ },
515
+ {
516
+ "epoch": 0.57,
517
+ "learning_rate": 4.568135300597306e-05,
518
+ "loss": 0.4233,
519
+ "step": 850
520
+ },
521
+ {
522
+ "epoch": 0.58,
523
+ "learning_rate": 4.5582261157176164e-05,
524
+ "loss": 0.4177,
525
+ "step": 860
526
+ },
527
+ {
528
+ "epoch": 0.58,
529
+ "learning_rate": 4.5482155371566384e-05,
530
+ "loss": 0.4236,
531
+ "step": 870
532
+ },
533
+ {
534
+ "epoch": 0.59,
535
+ "learning_rate": 4.538104058062042e-05,
536
+ "loss": 0.4228,
537
+ "step": 880
538
+ },
539
+ {
540
+ "epoch": 0.6,
541
+ "learning_rate": 4.5278921765521234e-05,
542
+ "loss": 0.4181,
543
+ "step": 890
544
+ },
545
+ {
546
+ "epoch": 0.6,
547
+ "learning_rate": 4.51758039569127e-05,
548
+ "loss": 0.4261,
549
+ "step": 900
550
+ },
551
+ {
552
+ "epoch": 0.61,
553
+ "learning_rate": 4.5071692234651764e-05,
554
+ "loss": 0.4217,
555
+ "step": 910
556
+ },
557
+ {
558
+ "epoch": 0.62,
559
+ "learning_rate": 4.4966591727558184e-05,
560
+ "loss": 0.4191,
561
+ "step": 920
562
+ },
563
+ {
564
+ "epoch": 0.62,
565
+ "learning_rate": 4.48605076131619e-05,
566
+ "loss": 0.4247,
567
+ "step": 930
568
+ },
569
+ {
570
+ "epoch": 0.63,
571
+ "learning_rate": 4.475344511744794e-05,
572
+ "loss": 0.4236,
573
+ "step": 940
574
+ },
575
+ {
576
+ "epoch": 0.64,
577
+ "learning_rate": 4.464540951459902e-05,
578
+ "loss": 0.4172,
579
+ "step": 950
580
+ },
581
+ {
582
+ "epoch": 0.64,
583
+ "learning_rate": 4.4536406126735664e-05,
584
+ "loss": 0.4209,
585
+ "step": 960
586
+ },
587
+ {
588
+ "epoch": 0.65,
589
+ "learning_rate": 4.442644032365407e-05,
590
+ "loss": 0.4179,
591
+ "step": 970
592
+ },
593
+ {
594
+ "epoch": 0.66,
595
+ "learning_rate": 4.431551752256155e-05,
596
+ "loss": 0.4166,
597
+ "step": 980
598
+ },
599
+ {
600
+ "epoch": 0.66,
601
+ "learning_rate": 4.420364318780973e-05,
602
+ "loss": 0.4173,
603
+ "step": 990
604
+ },
605
+ {
606
+ "epoch": 0.67,
607
+ "learning_rate": 4.4090822830625236e-05,
608
+ "loss": 0.4166,
609
+ "step": 1000
610
+ }
611
+ ],
612
+ "logging_steps": 10,
613
+ "max_steps": 4476,
614
+ "num_train_epochs": 3,
615
+ "save_steps": 200,
616
+ "total_flos": 9.097203781942116e+18,
617
+ "trial_name": null,
618
+ "trial_params": null
619
+ }
checkpoint-1000/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:729bf37ae27da0051469b6c2d9a7528c72ecfe49e138964d0506deffbecbf5dd
3
+ size 4283
checkpoint-1200/README.md ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: peft
3
+ base_model: /home/hz/projects/chatglm3-6b-32k
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
+ ### Framework versions
205
+
206
+
207
+ - PEFT 0.6.1
checkpoint-1200/adapter_config.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "/home/hz/projects/chatglm3-6b-32k",
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": 32.0,
12
+ "lora_dropout": 0.1,
13
+ "modules_to_save": null,
14
+ "peft_type": "LORA",
15
+ "r": 8,
16
+ "rank_pattern": {},
17
+ "revision": null,
18
+ "target_modules": [
19
+ "query_key_value"
20
+ ],
21
+ "task_type": "CAUSAL_LM"
22
+ }
checkpoint-1200/adapter_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f20c941e90bb5428a8c782b9fdd552a0a14752555acb90450f67d506fb61213e
3
+ size 7820185
checkpoint-1200/added_tokens.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "<|observation|>": 64797,
3
+ "<|user|>": 64795
4
+ }
checkpoint-1200/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:026f20db4aa943cf7fa1f4842646d76165d84726ac3b103486469d146cba2af2
3
+ size 15644485
checkpoint-1200/rng_state_0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df9c86207da192eb45fafab4e339545a4212fcdb73911f03f77b2c74e2826efe
3
+ size 21687
checkpoint-1200/rng_state_1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7f6ca0cecc54a94203b5893c79a4e9964e83f47d7fc3230251eb9aaaf8fdb015
3
+ size 21687
checkpoint-1200/rng_state_2.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cb9205267352ed3614f0586889fed442a66c3c59f8e7824c1af3cadb71f1fa3a
3
+ size 21687
checkpoint-1200/rng_state_3.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2b8666e3e6876bb78a90d36299e773a4dba514962e67e8bf9d2a2acbbe9c5373
3
+ size 21687
checkpoint-1200/rng_state_4.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d11de617b1d36bd8cf3a69ee99c9c9a4f30182d38f1f8a9b66e4482e42ec8e0a
3
+ size 21687
checkpoint-1200/rng_state_5.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:38a74118af5ea5a095571d00a792f8c938a69de0335db83aca2804fb6390924e
3
+ size 21687
checkpoint-1200/rng_state_6.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:72aa5252e4dd8473b5383b8c74bcf72acf8ea68bf6e54d1c263d57dec2fc1dd6
3
+ size 21687
checkpoint-1200/rng_state_7.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fdb22b5e950a14c4a77bfad244d30f4589fd1944c2820e5f560936cc1640af0c
3
+ size 21687
checkpoint-1200/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f3ae922322abc72af5a5a4e1e96d2b6312b8af582e691b3aadd460ab4b8f1cab
3
+ size 627
checkpoint-1200/special_tokens_map.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|user|>",
4
+ "<|observation|>"
5
+ ]
6
+ }
checkpoint-1200/tokenization_chatglm.py ADDED
@@ -0,0 +1,283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import os
3
+ import torch
4
+ from typing import List, Optional, Union, Dict
5
+ from sentencepiece import SentencePieceProcessor
6
+ from transformers import PreTrainedTokenizer
7
+ from transformers.utils import logging, PaddingStrategy
8
+ from transformers.tokenization_utils_base import EncodedInput, BatchEncoding
9
+
10
+
11
+ class SPTokenizer:
12
+ def __init__(self, model_path: str):
13
+ # reload tokenizer
14
+ assert os.path.isfile(model_path), model_path
15
+ self.sp_model = SentencePieceProcessor(model_file=model_path)
16
+
17
+ # BOS / EOS token IDs
18
+ self.n_words: int = self.sp_model.vocab_size()
19
+ self.bos_id: int = self.sp_model.bos_id()
20
+ self.eos_id: int = self.sp_model.eos_id()
21
+ self.pad_id: int = self.sp_model.unk_id()
22
+ assert self.sp_model.vocab_size() == self.sp_model.get_piece_size()
23
+
24
+ special_tokens = ["[MASK]", "[gMASK]", "[sMASK]", "sop", "eop", "<|system|>", "<|user|>", "<|assistant|>",
25
+ "<|observation|>"]
26
+ self.special_tokens = {}
27
+ self.index_special_tokens = {}
28
+ for token in special_tokens:
29
+ self.special_tokens[token] = self.n_words
30
+ self.index_special_tokens[self.n_words] = token
31
+ self.n_words += 1
32
+
33
+ def tokenize(self, s: str):
34
+ return self.sp_model.EncodeAsPieces(s)
35
+
36
+ def encode(self, s: str, bos: bool = False, eos: bool = False) -> List[int]:
37
+ assert type(s) is str
38
+ t = self.sp_model.encode(s)
39
+ if bos:
40
+ t = [self.bos_id] + t
41
+ if eos:
42
+ t = t + [self.eos_id]
43
+ return t
44
+
45
+ def decode(self, t: List[int]) -> str:
46
+ text, buffer = "", []
47
+ for token in t:
48
+ if token in self.index_special_tokens:
49
+ if buffer:
50
+ text += self.sp_model.decode(buffer)
51
+ buffer = []
52
+ text += self.index_special_tokens[token]
53
+ else:
54
+ buffer.append(token)
55
+ if buffer:
56
+ text += self.sp_model.decode(buffer)
57
+ return text
58
+
59
+ def decode_tokens(self, tokens: List[str]) -> str:
60
+ text = self.sp_model.DecodePieces(tokens)
61
+ return text
62
+
63
+ def convert_token_to_id(self, token):
64
+ """ Converts a token (str) in an id using the vocab. """
65
+ if token in self.special_tokens:
66
+ return self.special_tokens[token]
67
+ return self.sp_model.PieceToId(token)
68
+
69
+ def convert_id_to_token(self, index):
70
+ """Converts an index (integer) in a token (str) using the vocab."""
71
+ if index in self.index_special_tokens:
72
+ return self.index_special_tokens[index]
73
+ if index in [self.eos_id, self.bos_id, self.pad_id] or index < 0:
74
+ return ""
75
+ return self.sp_model.IdToPiece(index)
76
+
77
+
78
+ class ChatGLMTokenizer(PreTrainedTokenizer):
79
+ vocab_files_names = {"vocab_file": "tokenizer.model"}
80
+
81
+ model_input_names = ["input_ids", "attention_mask", "position_ids"]
82
+
83
+ def __init__(self, vocab_file, padding_side="left", clean_up_tokenization_spaces=False, **kwargs):
84
+ self.name = "GLMTokenizer"
85
+
86
+ self.vocab_file = vocab_file
87
+ self.tokenizer = SPTokenizer(vocab_file)
88
+ self.special_tokens = {
89
+ "<bos>": self.tokenizer.bos_id,
90
+ "<eos>": self.tokenizer.eos_id,
91
+ "<pad>": self.tokenizer.pad_id
92
+ }
93
+ super().__init__(padding_side=padding_side, clean_up_tokenization_spaces=clean_up_tokenization_spaces, **kwargs)
94
+
95
+ def get_command(self, token):
96
+ if token in self.special_tokens:
97
+ return self.special_tokens[token]
98
+ assert token in self.tokenizer.special_tokens, f"{token} is not a special token for {self.name}"
99
+ return self.tokenizer.special_tokens[token]
100
+
101
+ @property
102
+ def unk_token(self) -> str:
103
+ return "<unk>"
104
+
105
+ @property
106
+ def pad_token(self) -> str:
107
+ return "<unk>"
108
+
109
+ @property
110
+ def pad_token_id(self):
111
+ return self.get_command("<pad>")
112
+
113
+ @property
114
+ def eos_token(self) -> str:
115
+ return "</s>"
116
+
117
+ @property
118
+ def eos_token_id(self):
119
+ return self.get_command("<eos>")
120
+
121
+ @property
122
+ def vocab_size(self):
123
+ return self.tokenizer.n_words
124
+
125
+ def get_vocab(self):
126
+ """ Returns vocab as a dict """
127
+ vocab = {self._convert_id_to_token(i): i for i in range(self.vocab_size)}
128
+ vocab.update(self.added_tokens_encoder)
129
+ return vocab
130
+
131
+ def _tokenize(self, text, **kwargs):
132
+ return self.tokenizer.tokenize(text)
133
+
134
+ def _convert_token_to_id(self, token):
135
+ """ Converts a token (str) in an id using the vocab. """
136
+ return self.tokenizer.convert_token_to_id(token)
137
+
138
+ def _convert_id_to_token(self, index):
139
+ """Converts an index (integer) in a token (str) using the vocab."""
140
+ return self.tokenizer.convert_id_to_token(index)
141
+
142
+ def convert_tokens_to_string(self, tokens: List[str]) -> str:
143
+ return self.tokenizer.decode_tokens(tokens)
144
+
145
+ def save_vocabulary(self, save_directory, filename_prefix=None):
146
+ """
147
+ Save the vocabulary and special tokens file to a directory.
148
+
149
+ Args:
150
+ save_directory (`str`):
151
+ The directory in which to save the vocabulary.
152
+ filename_prefix (`str`, *optional*):
153
+ An optional prefix to add to the named of the saved files.
154
+
155
+ Returns:
156
+ `Tuple(str)`: Paths to the files saved.
157
+ """
158
+ if os.path.isdir(save_directory):
159
+ vocab_file = os.path.join(
160
+ save_directory, self.vocab_files_names["vocab_file"]
161
+ )
162
+ else:
163
+ vocab_file = save_directory
164
+
165
+ with open(self.vocab_file, 'rb') as fin:
166
+ proto_str = fin.read()
167
+
168
+ with open(vocab_file, "wb") as writer:
169
+ writer.write(proto_str)
170
+
171
+ return (vocab_file,)
172
+
173
+ def get_prefix_tokens(self):
174
+ prefix_tokens = [self.get_command("[gMASK]"), self.get_command("sop")]
175
+ return prefix_tokens
176
+
177
+ def build_single_message(self, role, metadata, message):
178
+ assert role in ["system", "user", "assistant", "observation"], role
179
+ role_tokens = [self.get_command(f"<|{role}|>")] + self.tokenizer.encode(f"{metadata}\n")
180
+ message_tokens = self.tokenizer.encode(message)
181
+ tokens = role_tokens + message_tokens
182
+ return tokens
183
+
184
+ def build_chat_input(self, query, history=None, role="user"):
185
+ if history is None:
186
+ history = []
187
+ input_ids = []
188
+ for item in history:
189
+ content = item["content"]
190
+ if item["role"] == "system" and "tools" in item:
191
+ content = content + "\n" + json.dumps(item["tools"], indent=4, ensure_ascii=False)
192
+ input_ids.extend(self.build_single_message(item["role"], item.get("metadata", ""), content))
193
+ input_ids.extend(self.build_single_message(role, "", query))
194
+ input_ids.extend([self.get_command("<|assistant|>")])
195
+ return self.batch_encode_plus([input_ids], return_tensors="pt", is_split_into_words=True)
196
+
197
+ def build_inputs_with_special_tokens(
198
+ self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None
199
+ ) -> List[int]:
200
+ """
201
+ Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
202
+ adding special tokens. A BERT sequence has the following format:
203
+
204
+ - single sequence: `[CLS] X [SEP]`
205
+ - pair of sequences: `[CLS] A [SEP] B [SEP]`
206
+
207
+ Args:
208
+ token_ids_0 (`List[int]`):
209
+ List of IDs to which the special tokens will be added.
210
+ token_ids_1 (`List[int]`, *optional*):
211
+ Optional second list of IDs for sequence pairs.
212
+
213
+ Returns:
214
+ `List[int]`: List of [input IDs](../glossary#input-ids) with the appropriate special tokens.
215
+ """
216
+ prefix_tokens = self.get_prefix_tokens()
217
+ token_ids_0 = prefix_tokens + token_ids_0
218
+ if token_ids_1 is not None:
219
+ token_ids_0 = token_ids_0 + token_ids_1 + [self.get_command("<eos>")]
220
+ return token_ids_0
221
+
222
+ def _pad(
223
+ self,
224
+ encoded_inputs: Union[Dict[str, EncodedInput], BatchEncoding],
225
+ max_length: Optional[int] = None,
226
+ padding_strategy: PaddingStrategy = PaddingStrategy.DO_NOT_PAD,
227
+ pad_to_multiple_of: Optional[int] = None,
228
+ return_attention_mask: Optional[bool] = None,
229
+ ) -> dict:
230
+ """
231
+ Pad encoded inputs (on left/right and up to predefined length or max length in the batch)
232
+
233
+ Args:
234
+ encoded_inputs:
235
+ Dictionary of tokenized inputs (`List[int]`) or batch of tokenized inputs (`List[List[int]]`).
236
+ max_length: maximum length of the returned list and optionally padding length (see below).
237
+ Will truncate by taking into account the special tokens.
238
+ padding_strategy: PaddingStrategy to use for padding.
239
+
240
+ - PaddingStrategy.LONGEST Pad to the longest sequence in the batch
241
+ - PaddingStrategy.MAX_LENGTH: Pad to the max length (default)
242
+ - PaddingStrategy.DO_NOT_PAD: Do not pad
243
+ The tokenizer padding sides are defined in self.padding_side:
244
+
245
+ - 'left': pads on the left of the sequences
246
+ - 'right': pads on the right of the sequences
247
+ pad_to_multiple_of: (optional) Integer if set will pad the sequence to a multiple of the provided value.
248
+ This is especially useful to enable the use of Tensor Core on NVIDIA hardware with compute capability
249
+ `>= 7.5` (Volta).
250
+ return_attention_mask:
251
+ (optional) Set to False to avoid returning attention mask (default: set to model specifics)
252
+ """
253
+ # Load from model defaults
254
+ assert self.padding_side == "left"
255
+
256
+ required_input = encoded_inputs[self.model_input_names[0]]
257
+ seq_length = len(required_input)
258
+
259
+ if padding_strategy == PaddingStrategy.LONGEST:
260
+ max_length = len(required_input)
261
+
262
+ if max_length is not None and pad_to_multiple_of is not None and (max_length % pad_to_multiple_of != 0):
263
+ max_length = ((max_length // pad_to_multiple_of) + 1) * pad_to_multiple_of
264
+
265
+ needs_to_be_padded = padding_strategy != PaddingStrategy.DO_NOT_PAD and len(required_input) != max_length
266
+
267
+ # Initialize attention mask if not present.
268
+ if "attention_mask" not in encoded_inputs:
269
+ encoded_inputs["attention_mask"] = [1] * seq_length
270
+
271
+ if "position_ids" not in encoded_inputs:
272
+ encoded_inputs["position_ids"] = list(range(seq_length))
273
+
274
+ if needs_to_be_padded:
275
+ difference = max_length - len(required_input)
276
+
277
+ if "attention_mask" in encoded_inputs:
278
+ encoded_inputs["attention_mask"] = [0] * difference + encoded_inputs["attention_mask"]
279
+ if "position_ids" in encoded_inputs:
280
+ encoded_inputs["position_ids"] = [0] * difference + encoded_inputs["position_ids"]
281
+ encoded_inputs[self.model_input_names[0]] = [self.pad_token_id] * difference + required_input
282
+
283
+ return encoded_inputs
checkpoint-1200/tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e7dc4c393423b76e4373e5157ddc34803a0189ba96b21ddbb40269d31468a6f2
3
+ size 1018370
checkpoint-1200/tokenizer_config.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "64795": {
4
+ "content": "<|user|>",
5
+ "lstrip": true,
6
+ "normalized": false,
7
+ "rstrip": true,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "64797": {
12
+ "content": "<|observation|>",
13
+ "lstrip": true,
14
+ "normalized": false,
15
+ "rstrip": true,
16
+ "single_word": false,
17
+ "special": true
18
+ }
19
+ },
20
+ "additional_special_tokens": [
21
+ "<|user|>",
22
+ "<|observation|>"
23
+ ],
24
+ "auto_map": {
25
+ "AutoTokenizer": [
26
+ "tokenization_chatglm.ChatGLMTokenizer",
27
+ null
28
+ ]
29
+ },
30
+ "clean_up_tokenization_spaces": false,
31
+ "do_lower_case": false,
32
+ "model_max_length": 1000000000000000019884624838656,
33
+ "padding_side": "right",
34
+ "remove_space": false,
35
+ "split_special_tokens": false,
36
+ "tokenizer_class": "ChatGLMTokenizer",
37
+ "tokenizer_file": null
38
+ }
checkpoint-1200/trainer_state.json ADDED
@@ -0,0 +1,739 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 0.8041547997989613,
5
+ "eval_steps": 500,
6
+ "global_step": 1200,
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.01,
13
+ "learning_rate": 4.99993842168232e-05,
14
+ "loss": 1.2211,
15
+ "step": 10
16
+ },
17
+ {
18
+ "epoch": 0.01,
19
+ "learning_rate": 4.9997536897627915e-05,
20
+ "loss": 1.0276,
21
+ "step": 20
22
+ },
23
+ {
24
+ "epoch": 0.02,
25
+ "learning_rate": 4.9994458133418e-05,
26
+ "loss": 0.8587,
27
+ "step": 30
28
+ },
29
+ {
30
+ "epoch": 0.03,
31
+ "learning_rate": 4.999014807586154e-05,
32
+ "loss": 0.7431,
33
+ "step": 40
34
+ },
35
+ {
36
+ "epoch": 0.03,
37
+ "learning_rate": 4.9984606937283405e-05,
38
+ "loss": 0.6841,
39
+ "step": 50
40
+ },
41
+ {
42
+ "epoch": 0.04,
43
+ "learning_rate": 4.9977834990654804e-05,
44
+ "loss": 0.6452,
45
+ "step": 60
46
+ },
47
+ {
48
+ "epoch": 0.05,
49
+ "learning_rate": 4.99698325695798e-05,
50
+ "loss": 0.6347,
51
+ "step": 70
52
+ },
53
+ {
54
+ "epoch": 0.05,
55
+ "learning_rate": 4.9960600068278876e-05,
56
+ "loss": 0.6109,
57
+ "step": 80
58
+ },
59
+ {
60
+ "epoch": 0.06,
61
+ "learning_rate": 4.995013794156957e-05,
62
+ "loss": 0.5911,
63
+ "step": 90
64
+ },
65
+ {
66
+ "epoch": 0.07,
67
+ "learning_rate": 4.993844670484401e-05,
68
+ "loss": 0.5803,
69
+ "step": 100
70
+ },
71
+ {
72
+ "epoch": 0.07,
73
+ "learning_rate": 4.992552693404354e-05,
74
+ "loss": 0.5902,
75
+ "step": 110
76
+ },
77
+ {
78
+ "epoch": 0.08,
79
+ "learning_rate": 4.991137926563036e-05,
80
+ "loss": 0.5745,
81
+ "step": 120
82
+ },
83
+ {
84
+ "epoch": 0.09,
85
+ "learning_rate": 4.9896004396556176e-05,
86
+ "loss": 0.5538,
87
+ "step": 130
88
+ },
89
+ {
90
+ "epoch": 0.09,
91
+ "learning_rate": 4.987940308422783e-05,
92
+ "loss": 0.5495,
93
+ "step": 140
94
+ },
95
+ {
96
+ "epoch": 0.1,
97
+ "learning_rate": 4.986157614647005e-05,
98
+ "loss": 0.5433,
99
+ "step": 150
100
+ },
101
+ {
102
+ "epoch": 0.11,
103
+ "learning_rate": 4.984252446148508e-05,
104
+ "loss": 0.548,
105
+ "step": 160
106
+ },
107
+ {
108
+ "epoch": 0.11,
109
+ "learning_rate": 4.98222489678095e-05,
110
+ "loss": 0.5361,
111
+ "step": 170
112
+ },
113
+ {
114
+ "epoch": 0.12,
115
+ "learning_rate": 4.980075066426796e-05,
116
+ "loss": 0.5331,
117
+ "step": 180
118
+ },
119
+ {
120
+ "epoch": 0.13,
121
+ "learning_rate": 4.977803060992393e-05,
122
+ "loss": 0.53,
123
+ "step": 190
124
+ },
125
+ {
126
+ "epoch": 0.13,
127
+ "learning_rate": 4.97540899240276e-05,
128
+ "loss": 0.5135,
129
+ "step": 200
130
+ },
131
+ {
132
+ "epoch": 0.14,
133
+ "learning_rate": 4.972892978596069e-05,
134
+ "loss": 0.5101,
135
+ "step": 210
136
+ },
137
+ {
138
+ "epoch": 0.15,
139
+ "learning_rate": 4.970255143517838e-05,
140
+ "loss": 0.5125,
141
+ "step": 220
142
+ },
143
+ {
144
+ "epoch": 0.15,
145
+ "learning_rate": 4.967495617114826e-05,
146
+ "loss": 0.4928,
147
+ "step": 230
148
+ },
149
+ {
150
+ "epoch": 0.16,
151
+ "learning_rate": 4.964614535328626e-05,
152
+ "loss": 0.4878,
153
+ "step": 240
154
+ },
155
+ {
156
+ "epoch": 0.17,
157
+ "learning_rate": 4.961612040088973e-05,
158
+ "loss": 0.5017,
159
+ "step": 250
160
+ },
161
+ {
162
+ "epoch": 0.17,
163
+ "learning_rate": 4.9584882793067534e-05,
164
+ "loss": 0.4863,
165
+ "step": 260
166
+ },
167
+ {
168
+ "epoch": 0.18,
169
+ "learning_rate": 4.955243406866713e-05,
170
+ "loss": 0.4847,
171
+ "step": 270
172
+ },
173
+ {
174
+ "epoch": 0.19,
175
+ "learning_rate": 4.951877582619881e-05,
176
+ "loss": 0.4868,
177
+ "step": 280
178
+ },
179
+ {
180
+ "epoch": 0.19,
181
+ "learning_rate": 4.948390972375694e-05,
182
+ "loss": 0.4748,
183
+ "step": 290
184
+ },
185
+ {
186
+ "epoch": 0.2,
187
+ "learning_rate": 4.944783747893825e-05,
188
+ "loss": 0.4764,
189
+ "step": 300
190
+ },
191
+ {
192
+ "epoch": 0.21,
193
+ "learning_rate": 4.941056086875727e-05,
194
+ "loss": 0.4712,
195
+ "step": 310
196
+ },
197
+ {
198
+ "epoch": 0.21,
199
+ "learning_rate": 4.937208172955876e-05,
200
+ "loss": 0.4642,
201
+ "step": 320
202
+ },
203
+ {
204
+ "epoch": 0.22,
205
+ "learning_rate": 4.9332401956927224e-05,
206
+ "loss": 0.4642,
207
+ "step": 330
208
+ },
209
+ {
210
+ "epoch": 0.23,
211
+ "learning_rate": 4.9291523505593604e-05,
212
+ "loss": 0.4709,
213
+ "step": 340
214
+ },
215
+ {
216
+ "epoch": 0.23,
217
+ "learning_rate": 4.9249448389338905e-05,
218
+ "loss": 0.461,
219
+ "step": 350
220
+ },
221
+ {
222
+ "epoch": 0.24,
223
+ "learning_rate": 4.920617868089501e-05,
224
+ "loss": 0.4677,
225
+ "step": 360
226
+ },
227
+ {
228
+ "epoch": 0.25,
229
+ "learning_rate": 4.9161716511842614e-05,
230
+ "loss": 0.4564,
231
+ "step": 370
232
+ },
233
+ {
234
+ "epoch": 0.25,
235
+ "learning_rate": 4.911606407250617e-05,
236
+ "loss": 0.4663,
237
+ "step": 380
238
+ },
239
+ {
240
+ "epoch": 0.26,
241
+ "learning_rate": 4.9069223611846014e-05,
242
+ "loss": 0.4682,
243
+ "step": 390
244
+ },
245
+ {
246
+ "epoch": 0.27,
247
+ "learning_rate": 4.9021197437347555e-05,
248
+ "loss": 0.4636,
249
+ "step": 400
250
+ },
251
+ {
252
+ "epoch": 0.27,
253
+ "learning_rate": 4.897198791490762e-05,
254
+ "loss": 0.4569,
255
+ "step": 410
256
+ },
257
+ {
258
+ "epoch": 0.28,
259
+ "learning_rate": 4.8921597468717887e-05,
260
+ "loss": 0.462,
261
+ "step": 420
262
+ },
263
+ {
264
+ "epoch": 0.29,
265
+ "learning_rate": 4.887002858114548e-05,
266
+ "loss": 0.4563,
267
+ "step": 430
268
+ },
269
+ {
270
+ "epoch": 0.29,
271
+ "learning_rate": 4.881728379261068e-05,
272
+ "loss": 0.4563,
273
+ "step": 440
274
+ },
275
+ {
276
+ "epoch": 0.3,
277
+ "learning_rate": 4.876336570146175e-05,
278
+ "loss": 0.4468,
279
+ "step": 450
280
+ },
281
+ {
282
+ "epoch": 0.31,
283
+ "learning_rate": 4.870827696384698e-05,
284
+ "loss": 0.4508,
285
+ "step": 460
286
+ },
287
+ {
288
+ "epoch": 0.31,
289
+ "learning_rate": 4.865202029358379e-05,
290
+ "loss": 0.4507,
291
+ "step": 470
292
+ },
293
+ {
294
+ "epoch": 0.32,
295
+ "learning_rate": 4.859459846202507e-05,
296
+ "loss": 0.4486,
297
+ "step": 480
298
+ },
299
+ {
300
+ "epoch": 0.33,
301
+ "learning_rate": 4.853601429792265e-05,
302
+ "loss": 0.4423,
303
+ "step": 490
304
+ },
305
+ {
306
+ "epoch": 0.34,
307
+ "learning_rate": 4.847627068728795e-05,
308
+ "loss": 0.4369,
309
+ "step": 500
310
+ },
311
+ {
312
+ "epoch": 0.34,
313
+ "learning_rate": 4.841537057324979e-05,
314
+ "loss": 0.4429,
315
+ "step": 510
316
+ },
317
+ {
318
+ "epoch": 0.35,
319
+ "learning_rate": 4.835331695590943e-05,
320
+ "loss": 0.4389,
321
+ "step": 520
322
+ },
323
+ {
324
+ "epoch": 0.36,
325
+ "learning_rate": 4.829011289219276e-05,
326
+ "loss": 0.44,
327
+ "step": 530
328
+ },
329
+ {
330
+ "epoch": 0.36,
331
+ "learning_rate": 4.82257614956997e-05,
332
+ "loss": 0.4476,
333
+ "step": 540
334
+ },
335
+ {
336
+ "epoch": 0.37,
337
+ "learning_rate": 4.816026593655085e-05,
338
+ "loss": 0.4367,
339
+ "step": 550
340
+ },
341
+ {
342
+ "epoch": 0.38,
343
+ "learning_rate": 4.809362944123129e-05,
344
+ "loss": 0.4357,
345
+ "step": 560
346
+ },
347
+ {
348
+ "epoch": 0.38,
349
+ "learning_rate": 4.802585529243164e-05,
350
+ "loss": 0.4492,
351
+ "step": 570
352
+ },
353
+ {
354
+ "epoch": 0.39,
355
+ "learning_rate": 4.795694682888635e-05,
356
+ "loss": 0.4403,
357
+ "step": 580
358
+ },
359
+ {
360
+ "epoch": 0.4,
361
+ "learning_rate": 4.7886907445209234e-05,
362
+ "loss": 0.4406,
363
+ "step": 590
364
+ },
365
+ {
366
+ "epoch": 0.4,
367
+ "learning_rate": 4.781574059172621e-05,
368
+ "loss": 0.4317,
369
+ "step": 600
370
+ },
371
+ {
372
+ "epoch": 0.41,
373
+ "learning_rate": 4.7743449774305386e-05,
374
+ "loss": 0.4379,
375
+ "step": 610
376
+ },
377
+ {
378
+ "epoch": 0.42,
379
+ "learning_rate": 4.7670038554184296e-05,
380
+ "loss": 0.4324,
381
+ "step": 620
382
+ },
383
+ {
384
+ "epoch": 0.42,
385
+ "learning_rate": 4.7595510547794465e-05,
386
+ "loss": 0.4329,
387
+ "step": 630
388
+ },
389
+ {
390
+ "epoch": 0.43,
391
+ "learning_rate": 4.751986942658332e-05,
392
+ "loss": 0.4259,
393
+ "step": 640
394
+ },
395
+ {
396
+ "epoch": 0.44,
397
+ "learning_rate": 4.744311891683325e-05,
398
+ "loss": 0.4256,
399
+ "step": 650
400
+ },
401
+ {
402
+ "epoch": 0.44,
403
+ "learning_rate": 4.736526279947807e-05,
404
+ "loss": 0.4289,
405
+ "step": 660
406
+ },
407
+ {
408
+ "epoch": 0.45,
409
+ "learning_rate": 4.728630490991676e-05,
410
+ "loss": 0.4353,
411
+ "step": 670
412
+ },
413
+ {
414
+ "epoch": 0.46,
415
+ "learning_rate": 4.7206249137824535e-05,
416
+ "loss": 0.4413,
417
+ "step": 680
418
+ },
419
+ {
420
+ "epoch": 0.46,
421
+ "learning_rate": 4.7125099426961185e-05,
422
+ "loss": 0.4302,
423
+ "step": 690
424
+ },
425
+ {
426
+ "epoch": 0.47,
427
+ "learning_rate": 4.704285977497687e-05,
428
+ "loss": 0.4365,
429
+ "step": 700
430
+ },
431
+ {
432
+ "epoch": 0.48,
433
+ "learning_rate": 4.6959534233215116e-05,
434
+ "loss": 0.4238,
435
+ "step": 710
436
+ },
437
+ {
438
+ "epoch": 0.48,
439
+ "learning_rate": 4.687512690651328e-05,
440
+ "loss": 0.4284,
441
+ "step": 720
442
+ },
443
+ {
444
+ "epoch": 0.49,
445
+ "learning_rate": 4.678964195300028e-05,
446
+ "loss": 0.4193,
447
+ "step": 730
448
+ },
449
+ {
450
+ "epoch": 0.5,
451
+ "learning_rate": 4.670308358389184e-05,
452
+ "loss": 0.4256,
453
+ "step": 740
454
+ },
455
+ {
456
+ "epoch": 0.5,
457
+ "learning_rate": 4.6615456063282944e-05,
458
+ "loss": 0.4288,
459
+ "step": 750
460
+ },
461
+ {
462
+ "epoch": 0.51,
463
+ "learning_rate": 4.652676370793784e-05,
464
+ "loss": 0.4335,
465
+ "step": 760
466
+ },
467
+ {
468
+ "epoch": 0.52,
469
+ "learning_rate": 4.643701088707736e-05,
470
+ "loss": 0.4271,
471
+ "step": 770
472
+ },
473
+ {
474
+ "epoch": 0.52,
475
+ "learning_rate": 4.634620202216366e-05,
476
+ "loss": 0.4304,
477
+ "step": 780
478
+ },
479
+ {
480
+ "epoch": 0.53,
481
+ "learning_rate": 4.625434158668246e-05,
482
+ "loss": 0.4249,
483
+ "step": 790
484
+ },
485
+ {
486
+ "epoch": 0.54,
487
+ "learning_rate": 4.6161434105922616e-05,
488
+ "loss": 0.4322,
489
+ "step": 800
490
+ },
491
+ {
492
+ "epoch": 0.54,
493
+ "learning_rate": 4.6067484156753234e-05,
494
+ "loss": 0.4229,
495
+ "step": 810
496
+ },
497
+ {
498
+ "epoch": 0.55,
499
+ "learning_rate": 4.597249636739815e-05,
500
+ "loss": 0.4252,
501
+ "step": 820
502
+ },
503
+ {
504
+ "epoch": 0.56,
505
+ "learning_rate": 4.5876475417207974e-05,
506
+ "loss": 0.413,
507
+ "step": 830
508
+ },
509
+ {
510
+ "epoch": 0.56,
511
+ "learning_rate": 4.577942603642959e-05,
512
+ "loss": 0.4186,
513
+ "step": 840
514
+ },
515
+ {
516
+ "epoch": 0.57,
517
+ "learning_rate": 4.568135300597306e-05,
518
+ "loss": 0.4233,
519
+ "step": 850
520
+ },
521
+ {
522
+ "epoch": 0.58,
523
+ "learning_rate": 4.5582261157176164e-05,
524
+ "loss": 0.4177,
525
+ "step": 860
526
+ },
527
+ {
528
+ "epoch": 0.58,
529
+ "learning_rate": 4.5482155371566384e-05,
530
+ "loss": 0.4236,
531
+ "step": 870
532
+ },
533
+ {
534
+ "epoch": 0.59,
535
+ "learning_rate": 4.538104058062042e-05,
536
+ "loss": 0.4228,
537
+ "step": 880
538
+ },
539
+ {
540
+ "epoch": 0.6,
541
+ "learning_rate": 4.5278921765521234e-05,
542
+ "loss": 0.4181,
543
+ "step": 890
544
+ },
545
+ {
546
+ "epoch": 0.6,
547
+ "learning_rate": 4.51758039569127e-05,
548
+ "loss": 0.4261,
549
+ "step": 900
550
+ },
551
+ {
552
+ "epoch": 0.61,
553
+ "learning_rate": 4.5071692234651764e-05,
554
+ "loss": 0.4217,
555
+ "step": 910
556
+ },
557
+ {
558
+ "epoch": 0.62,
559
+ "learning_rate": 4.4966591727558184e-05,
560
+ "loss": 0.4191,
561
+ "step": 920
562
+ },
563
+ {
564
+ "epoch": 0.62,
565
+ "learning_rate": 4.48605076131619e-05,
566
+ "loss": 0.4247,
567
+ "step": 930
568
+ },
569
+ {
570
+ "epoch": 0.63,
571
+ "learning_rate": 4.475344511744794e-05,
572
+ "loss": 0.4236,
573
+ "step": 940
574
+ },
575
+ {
576
+ "epoch": 0.64,
577
+ "learning_rate": 4.464540951459902e-05,
578
+ "loss": 0.4172,
579
+ "step": 950
580
+ },
581
+ {
582
+ "epoch": 0.64,
583
+ "learning_rate": 4.4536406126735664e-05,
584
+ "loss": 0.4209,
585
+ "step": 960
586
+ },
587
+ {
588
+ "epoch": 0.65,
589
+ "learning_rate": 4.442644032365407e-05,
590
+ "loss": 0.4179,
591
+ "step": 970
592
+ },
593
+ {
594
+ "epoch": 0.66,
595
+ "learning_rate": 4.431551752256155e-05,
596
+ "loss": 0.4166,
597
+ "step": 980
598
+ },
599
+ {
600
+ "epoch": 0.66,
601
+ "learning_rate": 4.420364318780973e-05,
602
+ "loss": 0.4173,
603
+ "step": 990
604
+ },
605
+ {
606
+ "epoch": 0.67,
607
+ "learning_rate": 4.4090822830625236e-05,
608
+ "loss": 0.4166,
609
+ "step": 1000
610
+ },
611
+ {
612
+ "epoch": 0.68,
613
+ "learning_rate": 4.3977062008838307e-05,
614
+ "loss": 0.4173,
615
+ "step": 1010
616
+ },
617
+ {
618
+ "epoch": 0.68,
619
+ "learning_rate": 4.3862366326608975e-05,
620
+ "loss": 0.4049,
621
+ "step": 1020
622
+ },
623
+ {
624
+ "epoch": 0.69,
625
+ "learning_rate": 4.374674143415096e-05,
626
+ "loss": 0.4143,
627
+ "step": 1030
628
+ },
629
+ {
630
+ "epoch": 0.7,
631
+ "learning_rate": 4.363019302745334e-05,
632
+ "loss": 0.4219,
633
+ "step": 1040
634
+ },
635
+ {
636
+ "epoch": 0.7,
637
+ "learning_rate": 4.3512726847999987e-05,
638
+ "loss": 0.4152,
639
+ "step": 1050
640
+ },
641
+ {
642
+ "epoch": 0.71,
643
+ "learning_rate": 4.339434868248665e-05,
644
+ "loss": 0.4153,
645
+ "step": 1060
646
+ },
647
+ {
648
+ "epoch": 0.72,
649
+ "learning_rate": 4.3275064362535966e-05,
650
+ "loss": 0.4148,
651
+ "step": 1070
652
+ },
653
+ {
654
+ "epoch": 0.72,
655
+ "learning_rate": 4.315487976441014e-05,
656
+ "loss": 0.4147,
657
+ "step": 1080
658
+ },
659
+ {
660
+ "epoch": 0.73,
661
+ "learning_rate": 4.303380080872145e-05,
662
+ "loss": 0.41,
663
+ "step": 1090
664
+ },
665
+ {
666
+ "epoch": 0.74,
667
+ "learning_rate": 4.291183346014063e-05,
668
+ "loss": 0.4119,
669
+ "step": 1100
670
+ },
671
+ {
672
+ "epoch": 0.74,
673
+ "learning_rate": 4.278898372710296e-05,
674
+ "loss": 0.4173,
675
+ "step": 1110
676
+ },
677
+ {
678
+ "epoch": 0.75,
679
+ "learning_rate": 4.266525766151238e-05,
680
+ "loss": 0.4119,
681
+ "step": 1120
682
+ },
683
+ {
684
+ "epoch": 0.76,
685
+ "learning_rate": 4.254066135844326e-05,
686
+ "loss": 0.4163,
687
+ "step": 1130
688
+ },
689
+ {
690
+ "epoch": 0.76,
691
+ "learning_rate": 4.2415200955840184e-05,
692
+ "loss": 0.4104,
693
+ "step": 1140
694
+ },
695
+ {
696
+ "epoch": 0.77,
697
+ "learning_rate": 4.228888263421557e-05,
698
+ "loss": 0.4045,
699
+ "step": 1150
700
+ },
701
+ {
702
+ "epoch": 0.78,
703
+ "learning_rate": 4.216171261634521e-05,
704
+ "loss": 0.413,
705
+ "step": 1160
706
+ },
707
+ {
708
+ "epoch": 0.78,
709
+ "learning_rate": 4.2033697166961716e-05,
710
+ "loss": 0.4112,
711
+ "step": 1170
712
+ },
713
+ {
714
+ "epoch": 0.79,
715
+ "learning_rate": 4.1904842592445906e-05,
716
+ "loss": 0.4018,
717
+ "step": 1180
718
+ },
719
+ {
720
+ "epoch": 0.8,
721
+ "learning_rate": 4.177515524051609e-05,
722
+ "loss": 0.4068,
723
+ "step": 1190
724
+ },
725
+ {
726
+ "epoch": 0.8,
727
+ "learning_rate": 4.1644641499915454e-05,
728
+ "loss": 0.4029,
729
+ "step": 1200
730
+ }
731
+ ],
732
+ "logging_steps": 10,
733
+ "max_steps": 4476,
734
+ "num_train_epochs": 3,
735
+ "save_steps": 200,
736
+ "total_flos": 1.0916468228205052e+19,
737
+ "trial_name": null,
738
+ "trial_params": null
739
+ }
checkpoint-1200/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:729bf37ae27da0051469b6c2d9a7528c72ecfe49e138964d0506deffbecbf5dd
3
+ size 4283
checkpoint-1400/README.md ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: peft
3
+ base_model: /home/hz/projects/chatglm3-6b-32k
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
+ ### Framework versions
205
+
206
+
207
+ - PEFT 0.6.1
checkpoint-1400/adapter_config.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "/home/hz/projects/chatglm3-6b-32k",
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": 32.0,
12
+ "lora_dropout": 0.1,
13
+ "modules_to_save": null,
14
+ "peft_type": "LORA",
15
+ "r": 8,
16
+ "rank_pattern": {},
17
+ "revision": null,
18
+ "target_modules": [
19
+ "query_key_value"
20
+ ],
21
+ "task_type": "CAUSAL_LM"
22
+ }
checkpoint-1400/adapter_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2adba2088f9c10df3366820a3640d294362738b7833f646fb0aada9e022509b4
3
+ size 7820185
checkpoint-1400/added_tokens.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "<|observation|>": 64797,
3
+ "<|user|>": 64795
4
+ }