mtasic85 commited on
Commit
fd468b1
1 Parent(s): 3582732

trained new 128k tokenizer

Browse files
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
scripts/TRAIN.md ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Train
2
+
3
+ ## Environment
4
+
5
+ ```bash
6
+ cd scripts
7
+ python -m venv venv
8
+ source venv/bin/activate
9
+ pip install -U -r requirements.in
10
+ ```
11
+
12
+ ## Tokenizer
13
+
14
+ ```bash
15
+ python -B train_tokenizer.py
16
+ ```
17
+
18
+ ## Dataset
19
+
20
+ ```bash
21
+ python -B prepare_pretrain_dataset.py
22
+ ```
23
+
24
+ ## Model
25
+
26
+ ### Pretrain
27
+
28
+ ```bash
29
+ litgpt pretrain --config ./model.yaml
30
+ ```
31
+
32
+ ```bash
33
+ litgpt convert_from_litgpt out/pretrain/final/ out/converted_model
34
+ cp config.json out/pretrain/final/
35
+ cp config.json out/converted_model/
36
+ ```
37
+
38
+ ```python
39
+ import torch
40
+ from safetensors.torch import save_file
41
+
42
+ state_dict = torch.load('out/converted_model/model.pth', map_location='cpu')
43
+ save_file(state_dict, 'out/converted_model/model.safetensors')
44
+ ```
45
+
46
+ ## Evaluate
47
+
48
+ ```bash
49
+ litgpt evaluate --tasks 'leaderboard' --out_dir 'evaluate-0/' --batch_size 4 --dtype 'bfloat16' out/pretrain/final/
50
+
51
+ litgpt evaluate --tasks 'hellaswag,gsm8k,truthfulqa_mc2,mmlu,winogrande,arc_challenge' --out_dir 'evaluate-1/' --batch_size 4 --dtype 'bfloat16' out/pretrain/final/
52
+
53
+ litgpt evaluate --tasks 'mmlu_pro,ifeval,mgsm_direct,mathqa,gpqa' --out_dir 'evaluate-2/' --batch_size 4 --dtype 'bfloat16' out/pretrain/final/
54
+ ```
scripts/model.yaml ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # The name of the model to pretrain. Choose from names in ``litgpt.config``. Mutually exclusive with
2
+ # ``model_config``. (type: Optional[str], default: null)
3
+ model_name: "tiny-llama-1.1b"
4
+
5
+ # A ``litgpt.Config`` object to define the model architecture. Mutually exclusive with
6
+ # ``model_config``. (type: Optional[Config], default: null)
7
+ model_config:
8
+ padded_vocab_size: 32768
9
+ vocab_size: 32768
10
+ block_size: 131072
11
+ n_layer: 10
12
+ n_head: 32
13
+ head_size: null
14
+ n_embd: 320
15
+ n_query_groups: 8
16
+ rotary_percentage: 1.0
17
+ parallel_residual: false
18
+ bias: false
19
+ norm_class_name: "RMSNorm"
20
+ norm_eps: 1e-05
21
+ mlp_class_name: "LLaMAMLP"
22
+ intermediate_size: 1120
23
+ rope_base: 1000000
24
+
25
+ # Directory in which to save checkpoints and logs. If running in a Lightning Studio Job, look for it in
26
+ # /teamspace/jobs/<job-name>/share. (type: <class 'Path'>, default: out/pretrain)
27
+ out_dir: "../out/pretrain/"
28
+
29
+ # The precision to use for pretraining. Possible choices: "bf16-true", "bf16-mixed", "32-true". (type: Optional[str], default: null)
30
+ # precision: bf16-mixed
31
+ precision: bf16-true
32
+
33
+ # Optional path to a checkpoint directory to initialize the model from.
34
+ # Useful for continued pretraining. Mutually exclusive with ``resume``. (type: Optional[Path], default: null)
35
+ initial_checkpoint_dir:
36
+
37
+ # Path to a checkpoint directory to resume from in case training was interrupted, or ``True`` to resume
38
+ # from the latest checkpoint in ``out_dir``. An error will be raised if no checkpoint is found. Passing
39
+ # ``'auto'`` will resume from the latest checkpoint but not error if no checkpoint exists.
40
+ # (type: Union[bool, Literal["auto"], Path], default: False)
41
+ # resume: false
42
+ resume: "auto"
43
+
44
+ # Data-related arguments. If not provided, the default is ``litgpt.data.TinyLlama``.
45
+ data:
46
+ class_path: LitData
47
+
48
+ init_args:
49
+ data_path: "../data/"
50
+ num_workers: 16
51
+
52
+ # Training-related arguments. See ``litgpt.args.TrainArgs`` for details
53
+ train:
54
+ # Number of optimizer steps between saving checkpoints (type: Optional[int], default: 1000)
55
+ save_interval: 1000
56
+
57
+ # Number of iterations between logging calls (type: int, default: 1)
58
+ log_interval: 1
59
+
60
+ # Number of samples between optimizer steps across data-parallel ranks (type: int, default: 512)
61
+ global_batch_size: 512
62
+
63
+ # Number of samples per data-parallel rank (type: int, default: 4)
64
+ micro_batch_size: 4
65
+
66
+ # Number of iterations with learning rate warmup active (type: int, default: 2000)
67
+ lr_warmup_steps: 2000
68
+
69
+ # Number of epochs to train on (type: Optional[int], default: null)
70
+ epochs:
71
+
72
+ # Total number of tokens to train on (type: Optional[int], default: 3000000000000)
73
+ # max_tokens: 3000000000000
74
+ max_tokens: 8628998688 # 351072 * 8193 * 3
75
+
76
+ # Limits the number of optimizer steps to run. (type: Optional[int], default: null)
77
+ max_steps:
78
+
79
+ # Limits the length of samples. Off by default (type: Optional[int], default: null)
80
+ max_seq_length: 8192
81
+
82
+ # Whether to tie the embedding weights with the language modeling head weights. (type: Optional[bool], default: False)
83
+ tie_embeddings:
84
+
85
+ # (type: Optional[float], default: 1.0)
86
+ max_norm: 1.0
87
+
88
+ # (type: float, default: 4e-05)
89
+ min_lr: 4e-05
90
+
91
+ # Evaluation-related arguments. See ``litgpt.args.EvalArgs`` for details
92
+ eval:
93
+ # Number of optimizer steps between evaluation calls (type: int, default: 1000)
94
+ interval: 50
95
+
96
+ # Number of tokens to generate (type: Optional[int], default: null)
97
+ max_new_tokens:
98
+
99
+ # Number of iterations (type: int, default: 100)
100
+ max_iters: 100
101
+
102
+ # Whether to evaluate on the validation set at the beginning of the training
103
+ initial_validation: false
104
+
105
+ # Whether to evaluate on the validation set at the end the training
106
+ final_validation: true
107
+
108
+ # Optimizer-related arguments
109
+ optimizer:
110
+ # class_path: torch.optim.AdamW
111
+ class_path: grokadamw.GrokAdamW
112
+ # class_path: bitsandbytes.optim.AdamW8bit
113
+ # class_path: bitsandbytes.optim.PagedAdamW8bit
114
+
115
+ init_args:
116
+ # (type: float, default: 0.001)
117
+ lr: 1e-3
118
+
119
+ # (type: float, default: 0.01)
120
+ weight_decay: 0.01
121
+
122
+ # (type: tuple, default: (0.9,0.999))
123
+ betas:
124
+ - 0.9
125
+ - 0.95
126
+
127
+ # How many devices/GPUs to use. Uses all GPUs by default. (type: Union[int, str], default: auto)
128
+ devices: auto
129
+
130
+ # How many nodes to use. (type: int, default: 1)
131
+ num_nodes: 1
132
+
133
+ # Optional path to the tokenizer dir that was used for preprocessing the dataset. Only some data
134
+ # module require this. (type: Optional[Path], default: null)
135
+ tokenizer_dir: "../"
136
+
137
+ # The name of the logger to send metrics to. (type: Literal['wandb', 'tensorboard', 'csv'], default: tensorboard)
138
+ logger_name: "wandb"
139
+
140
+ # The random seed to use for reproducibility. (type: int, default: 42)
141
+ seed: 42
scripts/prepare_pretrain_dataset.py ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gc
2
+
3
+ from datasets import load_dataset
4
+ from litdata import optimize, TokensLoader
5
+ from litgpt.tokenizer import Tokenizer
6
+ from functools import partial
7
+
8
+
9
+ def batch_iterator(name=None):
10
+ # text
11
+ if name in (None, 'xu-song/cc100-samples'):
12
+ dataset = (
13
+ load_dataset(name, lang, split='train')
14
+ for lang in ['am', 'ar', 'as', 'az', 'be', 'bg', 'bn', 'bn_rom', 'br', 'bs', 'ca', 'cs', 'cy', 'da', 'de', 'el', 'en', 'eo', 'es', 'et', 'eu', 'fa', 'ff', 'fi', 'fr', 'fy', 'ga', 'gd', 'gl', 'gn', 'gu', 'ha', 'he', 'hi', 'hi_rom', 'hr', 'ht', 'hu', 'hy', 'id', 'ig', 'is', 'it', 'ja', 'jv', 'ka', 'kk', 'km', 'kn', 'ko', 'ku', 'ky', 'la', 'lg', 'li', 'ln', 'lo', 'lt', 'lv', 'mg', 'mk', 'ml', 'mn', 'mr', 'ms', 'my', 'my_zaw', 'ne', 'nl', 'no', 'ns', 'om', 'or', 'pa', 'pl', 'ps', 'pt', 'qu', 'rm', 'ro', 'ru', 'sa', 'si', 'sc', 'sd', 'sk', 'sl', 'so', 'sq', 'sr', 'ss', 'su', 'sv', 'sw', 'ta', 'ta_rom', 'te', 'te_rom', 'th', 'tl', 'tn', 'tr', 'ug', 'uk', 'ur', 'ur_rom', 'uz', 'vi', 'wo', 'xh', 'yi', 'yo', 'zh-Hans', 'zh-Hant', 'zu']
15
+ )
16
+
17
+ for d in dataset:
18
+ for row in d['text']:
19
+ yield row
20
+
21
+ del dataset
22
+ gc.collect()
23
+
24
+ # code
25
+ if name in (None, 'bigcode/the-stack-smol-xs'):
26
+ dataset = (
27
+ load_dataset(name, lang, split='train', trust_remote_code=True)
28
+ for lang in [
29
+ 'ada', 'agda', 'alloy', 'antlr', 'applescript', 'assembly', 'augeas', 'awk', 'batchfile', 'bison', 'bluespec', 'c',
30
+ 'c++', 'c-sharp', 'clojure', 'cmake', 'coffeescript', 'common-lisp', 'css', 'cuda', 'dart', 'dockerfile', 'elixir',
31
+ 'elm', 'emacs-lisp','erlang', 'f-sharp', 'fortran', 'glsl', 'go', 'groovy', 'haskell','html', 'idris', 'isabelle', 'java',
32
+ 'java-server-pages', 'javascript', 'julia', 'kotlin', 'lean', 'literate-agda', 'literate-coffeescript', 'literate-haskell',
33
+ 'lua', 'makefile', 'maple', 'markdown', 'mathematica', 'matlab', 'ocaml', 'pascal', 'perl', 'php', 'powershell', 'prolog',
34
+ 'protocol-buffer', 'python', 'r', 'racket', 'restructuredtext', 'rmarkdown', 'ruby', 'rust', 'sas', 'scala', 'scheme',
35
+ 'shell', 'smalltalk', 'solidity', 'sparql', 'sql', 'stan', 'standard-ml', 'stata', 'systemverilog', 'tcl', 'tcsh', 'tex',
36
+ 'thrift', 'typescript', 'verilog', 'vhdl', 'visual-basic', 'xslt', 'yacc', 'zig'
37
+ ]
38
+ )
39
+
40
+ for d in dataset:
41
+ for row in d:
42
+ yield row['content']
43
+
44
+ del dataset
45
+ gc.collect()
46
+
47
+ # text
48
+ if name in (None, 'nampdn-ai/tiny-textbooks'):
49
+ dataset = load_dataset(name, split='train')
50
+
51
+ for row in dataset:
52
+ yield row['textbook']
53
+
54
+ del dataset
55
+ gc.collect()
56
+
57
+ # code
58
+ if name in (None, 'm-a-p/CodeFeedback-Filtered-Instruction'):
59
+ dataset = load_dataset(name, split='train')
60
+
61
+ for row in dataset:
62
+ yield row['query'] + '\n' + row['answer']
63
+
64
+ del dataset
65
+ gc.collect()
66
+
67
+ # code
68
+ if name in (None, 'nampdn-ai/tiny-codes'):
69
+ dataset = load_dataset(name, split='train')
70
+
71
+ for row in dataset:
72
+ yield row['prompt'] + '\n' + row['response']
73
+
74
+ del dataset
75
+ gc.collect()
76
+
77
+ # math
78
+ if name in (None, 'ajibawa-2023/Maths-College'):
79
+ dataset = load_dataset(name, split='train')
80
+
81
+ for row in dataset:
82
+ yield row['instruction'] + '\n' + row['output']
83
+
84
+ del dataset
85
+ gc.collect()
86
+
87
+ # math
88
+ if name in (None, 'microsoft/orca-math-word-problems-200k'):
89
+ dataset = load_dataset(name, split='train')
90
+
91
+ for row in dataset:
92
+ yield row['question'] + '\n' + row['answer']
93
+
94
+ del dataset
95
+ gc.collect()
96
+
97
+ # math serbian
98
+ if name in (None, 'datatab/orca_math_world_problem_200k_serbian'):
99
+ dataset = load_dataset(name, split='train')
100
+
101
+ for row in dataset:
102
+ yield row['question_translated_srb'] + '\n' + row['answer_translated_srb']
103
+
104
+ del dataset
105
+ gc.collect()
106
+
107
+ # emoji
108
+ if name in (None, 'badrex/llm-emoji-dataset'):
109
+ dataset = load_dataset(name, split='train')
110
+
111
+ for row in dataset:
112
+ yield f'{row["character"]}\n{row["unicode"]}\n{row["short description"]}\n{row["tags"]}\n{row["LLM description"]}'
113
+
114
+ del dataset
115
+ gc.collect()
116
+
117
+ # instructions
118
+ alpaca_datasets_names = [
119
+ 'saillab/alpaca-english-cleaned',
120
+ 'saillab/alpaca-serbian-cleaned',
121
+ 'saillab/alpaca-croatian-cleaned',
122
+ 'saillab/alpaca-bosnian-cleaned',
123
+ 'saillab/alpaca-macedonian-cleaned',
124
+ 'saillab/alpaca-slovenian-cleaned',
125
+ ]
126
+
127
+ if name in (None, *alpaca_datasets_names):
128
+ for split in ['train', 'test']:
129
+ dataset = load_dataset(name, split=split)
130
+
131
+ for row in dataset:
132
+ if row['input'] in (None, '', 'nan'):
133
+ yield row['instruction'] + '\n' + row['output']
134
+ else:
135
+ yield row['instruction'] + '\n' + row['input'] + '\n' + row['output']
136
+
137
+ del dataset
138
+ gc.collect()
139
+
140
+
141
+ def tokenize_fn(dataset_name, tokenizer=None):
142
+ for text in batch_iterator(dataset_name):
143
+ text_ids = tokenizer.encode(text, bos=False, eos=True)
144
+ yield text_ids
145
+
146
+
147
+ datasets_names = [
148
+ 'xu-song/cc100-samples',
149
+ 'bigcode/the-stack-smol-xs',
150
+ 'nampdn-ai/tiny-textbooks',
151
+ 'm-a-p/CodeFeedback-Filtered-Instruction',
152
+ 'nampdn-ai/tiny-codes',
153
+ 'ajibawa-2023/Maths-College',
154
+ 'microsoft/orca-math-word-problems-200k',
155
+ 'datatab/orca_math_world_problem_200k_serbian',
156
+ 'badrex/llm-emoji-dataset',
157
+ 'saillab/alpaca-english-cleaned',
158
+ 'saillab/alpaca-serbian-cleaned',
159
+ 'saillab/alpaca-croatian-cleaned',
160
+ 'saillab/alpaca-bosnian-cleaned',
161
+ 'saillab/alpaca-macedonian-cleaned',
162
+ 'saillab/alpaca-slovenian-cleaned',
163
+ ]
164
+
165
+ outputs = optimize(
166
+ fn=partial(tokenize_fn, tokenizer=Tokenizer('..')),
167
+ inputs=datasets_names,
168
+ output_dir='../data/',
169
+ # Number of tokens to store by chunks. This is roughly 64MB of tokens per chunk.
170
+ chunk_size=(8193 * 2003),
171
+ num_workers=16,
172
+ )
scripts/requirements.in ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
2
+
3
+ tqdm
4
+ datasets
5
+ jinja2
6
+ transformers
7
+ wandb
8
+ # litgpt[all]
9
+ litgpt[all] @ git+https://github.com/Lightning-AI/litgpt.git
10
+ litdata
11
+ grokadamw
12
+ # bitsandbytes
scripts/train_tokenizer.py ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gc
2
+ import sys
3
+
4
+ from datasets import load_dataset
5
+ from transformers import PreTrainedTokenizerFast
6
+ from tokenizers import Tokenizer, normalizers, pre_tokenizers, processors, decoders
7
+ from tokenizers.models import BPE
8
+ from tokenizers.trainers import BpeTrainer
9
+ from tokenizers.processors import TemplateProcessing
10
+
11
+
12
+ x = input('Are you sure? [y/N] ')
13
+
14
+ if x not in ('y', 'Y', 'yes'):
15
+ sys.exit(0)
16
+
17
+
18
+ def batch_iterator():
19
+ # text
20
+ dataset = (
21
+ load_dataset('saillab/taco-datasets', data_dir=data_dir, split='train')
22
+ for data_dir in [
23
+ 'multilingual-instruction-tuning-dataset /multilingual-alpaca-52k-gpt-4',
24
+ 'multilingual-instruction-tuning-dataset /multilinugal-dolly-15k',
25
+ ]
26
+ )
27
+
28
+ for d in dataset:
29
+ for row in d:
30
+ for n in row:
31
+ yield row['instruction'] + '\n' + row['input'] + '\n' + row['output']
32
+
33
+ del dataset
34
+ gc.collect()
35
+
36
+ # text
37
+ dataset = (
38
+ load_dataset('xu-song/cc100-samples', lang, split='train')
39
+ for lang in [
40
+ 'am', 'ar', 'as', 'az', 'be', 'bg', 'bn', 'bn_rom', 'br',
41
+ 'bs', 'ca', 'cs', 'cy', 'da', 'de', 'el', 'en', 'eo', 'es',
42
+ 'et', 'eu', 'fa', 'ff', 'fi', 'fr', 'fy', 'ga', 'gd', 'gl',
43
+ 'gn', 'gu', 'ha', 'he', 'hi', 'hi_rom', 'hr', 'ht', 'hu',
44
+ 'hy', 'id', 'ig', 'is', 'it', 'ja', 'jv', 'ka', 'kk', 'km',
45
+ 'kn', 'ko', 'ku', 'ky', 'la', 'lg', 'li', 'ln', 'lo', 'lt',
46
+ 'lv', 'mg', 'mk', 'ml', 'mn', 'mr', 'ms', 'my', 'my_zaw',
47
+ 'ne', 'nl', 'no', 'ns', 'om', 'or', 'pa', 'pl', 'ps', 'pt',
48
+ 'qu', 'rm', 'ro', 'ru', 'sa', 'si', 'sc', 'sd', 'sk', 'sl',
49
+ 'so', 'sq', 'sr', 'ss', 'su', 'sv', 'sw', 'ta', 'ta_rom',
50
+ 'te', 'te_rom', 'th', 'tl', 'tn', 'tr', 'ug', 'uk', 'ur',
51
+ 'ur_rom', 'uz', 'vi', 'wo', 'xh', 'yi', 'yo',
52
+ 'zh-Hans', 'zh-Hant', 'zu',
53
+ ]
54
+ )
55
+
56
+ for d in dataset:
57
+ for row in d['text']:
58
+ yield row
59
+
60
+ del dataset
61
+ gc.collect()
62
+
63
+ # code
64
+ dataset = load_dataset('bigcode/programming-languages-keywords', split='train')
65
+
66
+ for row in dataset:
67
+ for n in row['keywords']:
68
+ yield n
69
+
70
+ del dataset
71
+ gc.collect()
72
+
73
+ # code
74
+ dataset = (
75
+ load_dataset('bigcode/the-stack-smol-xs', lang, split='train', trust_remote_code=True)
76
+ for lang in [
77
+ 'ada', 'agda', 'alloy', 'antlr', 'applescript', 'assembly',
78
+ 'augeas', 'awk', 'batchfile', 'bison', 'bluespec', 'c',
79
+ 'c++', 'c-sharp', 'clojure', 'cmake', 'coffeescript', 'common-lisp',
80
+ 'css', 'cuda', 'dart', 'dockerfile', 'elixir',
81
+ 'elm', 'emacs-lisp','erlang', 'f-sharp', 'fortran', 'glsl', 'go',
82
+ 'groovy', 'haskell','html', 'idris', 'isabelle', 'java',
83
+ 'java-server-pages', 'javascript', 'julia', 'kotlin', 'lean',
84
+ 'literate-agda', 'literate-coffeescript', 'literate-haskell',
85
+ 'lua', 'makefile', 'maple', 'markdown', 'mathematica', 'matlab',
86
+ 'ocaml', 'pascal', 'perl', 'php', 'powershell', 'prolog',
87
+ 'protocol-buffer', 'python', 'r', 'racket', 'restructuredtext',
88
+ 'rmarkdown', 'ruby', 'rust', 'sas', 'scala', 'scheme',
89
+ 'shell', 'smalltalk', 'solidity', 'sparql', 'sql', 'stan',
90
+ 'standard-ml', 'stata', 'systemverilog', 'tcl', 'tcsh', 'tex',
91
+ 'thrift', 'typescript', 'verilog', 'vhdl', 'visual-basic', 'xslt',
92
+ 'yacc', 'zig',
93
+ ]
94
+ )
95
+
96
+ for d in dataset:
97
+ for row in d:
98
+ yield row['content']
99
+
100
+ del dataset
101
+ gc.collect()
102
+
103
+ # text + code
104
+ dataset = load_dataset('m-a-p/CodeFeedback-Filtered-Instruction', split='train')
105
+
106
+ for row in dataset:
107
+ yield row['query'] + '\n' + row['answer']
108
+
109
+ del dataset
110
+ gc.collect()
111
+
112
+ # math
113
+ dataset = load_dataset('microsoft/orca-math-word-problems-200k', split='train')
114
+
115
+ for row in dataset:
116
+ yield row['question'] + '\n' + row['answer']
117
+
118
+ del dataset
119
+ gc.collect()
120
+
121
+ # math
122
+ dataset = load_dataset('ajibawa-2023/Maths-College', split='train')
123
+
124
+ for row in dataset:
125
+ yield row['instruction'] + '\n' + row['output']
126
+
127
+ del dataset
128
+ gc.collect()
129
+
130
+ # emoji
131
+ dataset = load_dataset('badrex/llm-emoji-dataset', split='train')
132
+
133
+ for row in dataset:
134
+ yield f'{row["character"]}\n{row["unicode"]}\n{row["short description"]}\n{row["tags"]}\n{row["LLM description"]}'
135
+
136
+ del dataset
137
+ gc.collect()
138
+
139
+
140
+ bpe = BPE(unk_token=None, fuse_unk=False, byte_fallback=False, ignore_merges=True)
141
+ tokenizer = Tokenizer(bpe)
142
+
143
+ special_tokens = [
144
+ '<unk>',
145
+ '<s>',
146
+ '</s>',
147
+ '<|im_start|>',
148
+ '<|im_end|>',
149
+ 'system',
150
+ 'user',
151
+ 'assistant',
152
+ 'tool',
153
+
154
+ '<tools>',
155
+ '</tools>',
156
+ '<tool_call>',
157
+ '</tool_call>',
158
+ '<tool_response>',
159
+ '</tool_response>',
160
+
161
+ '"arguments"',
162
+ '"name"',
163
+
164
+ '<arguments>',
165
+ '</arguments>',
166
+ '<argument>',
167
+ '</argument>',
168
+ '<argument-name>',
169
+ '</argument-name>',
170
+ '<argument-type>',
171
+ '</argument-type>',
172
+ '<argument-value>',
173
+ '</argument-value>',
174
+ '<parameter>',
175
+ '</parameter>',
176
+ '<parameter-name>',
177
+ '</parameter-name>',
178
+ '<parameter-type>',
179
+ '</parameter-type>',
180
+ '<parameter-value>',
181
+ '</parameter-value>',
182
+ '<field>',
183
+ '</field>',
184
+ '<field-name>',
185
+ '</field-name>',
186
+ '<field-type>',
187
+ '</field-type>',
188
+ '<field-value>',
189
+ '</field-value>',
190
+ '<name>',
191
+ '</name>',
192
+ '<type>',
193
+ '</type>',
194
+ '<value>',
195
+ '</value>',
196
+ '<function>',
197
+ '</function>',
198
+ '<function-name>',
199
+ '</function-name>',
200
+ '<function-type>',
201
+ '</function-type>',
202
+ '<function-value>',
203
+ '</function-value>',
204
+ ]
205
+
206
+ for i in range(2, 25):
207
+ special_tokens.append(' ' * i)
208
+
209
+ for i in range(128 - len(special_tokens)):
210
+ special_tokens.append(f'<|reserved_{i}|>')
211
+
212
+ # emoji
213
+ dataset = load_dataset('badrex/llm-emoji-dataset', split='train')
214
+ emoji_chars = [row['character'] for row in dataset if len(row['character']) == 1]
215
+ del dataset
216
+
217
+ # programming languages
218
+ dataset = load_dataset('Tanvir1337/programming-languages', split='train')
219
+ programming_languages = [n for row in dataset for n in row['text']]
220
+ del dataset
221
+
222
+ # programming languages keywords
223
+ dataset = load_dataset('bigcode/programming-languages-keywords', split='train')
224
+ code_keywords = [n for row in dataset for n in row['keywords']]
225
+ del dataset
226
+
227
+ tokenizer.pre_tokenizer = pre_tokenizers.ByteLevel(add_prefix_space=False, trim_offsets=True, use_regex=True)
228
+
229
+ tokenizer.post_processor = TemplateProcessing(
230
+ single='$A:0', # $A represents the token, :0 specifies the type ID for single sequences
231
+ pair='$A:0 $B:1', # For pairs, we specify type IDs for both tokens
232
+ special_tokens=[],
233
+ )
234
+
235
+ tokenizer.decoder = decoders.ByteLevel(add_prefix_space=False, trim_offsets=True, use_regex=True)
236
+
237
+ trainer = BpeTrainer(
238
+ vocab_size=131072, # 2 ** 17, 128k
239
+ min_frequency=2,
240
+ special_tokens=special_tokens,
241
+ initial_alphabet=emoji_chars + programming_languages + code_keywords,
242
+ )
243
+
244
+ tokenizer.train_from_iterator(batch_iterator(), trainer)
245
+ tokenizer.save('../tokenizer.json')
246
+ tokenizer.model.save('../')
247
+
248
+ CHATML_CHAT_TEMPLATE = (
249
+ "{% for message in messages %}"
250
+ "{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}"
251
+ "{% endfor %}"
252
+ "{% if add_generation_prompt %}"
253
+ "{{ '<|im_start|>assistant\n' }}"
254
+ "{% endif %}"
255
+ )
256
+
257
+ fast_tokenizer = PreTrainedTokenizerFast(
258
+ tokenizer_object=tokenizer,
259
+ chat_template=CHATML_CHAT_TEMPLATE,
260
+ bos_token='<s>',
261
+ eos_token='</s>',
262
+ unk_token='<unk>',
263
+ pad_token='</s>',
264
+ clean_up_tokenization_spaces=False,
265
+ )
266
+
267
+ fast_tokenizer.save_pretrained('../')
special_tokens_map.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "eos_token": "</s>",
4
+ "pad_token": "</s>",
5
+ "unk_token": "<unk>"
6
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,1036 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<unk>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<s>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "</s>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "<|im_start|>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "4": {
36
+ "content": "<|im_end|>",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ },
43
+ "5": {
44
+ "content": "system",
45
+ "lstrip": false,
46
+ "normalized": false,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": true
50
+ },
51
+ "6": {
52
+ "content": "user",
53
+ "lstrip": false,
54
+ "normalized": false,
55
+ "rstrip": false,
56
+ "single_word": false,
57
+ "special": true
58
+ },
59
+ "7": {
60
+ "content": "assistant",
61
+ "lstrip": false,
62
+ "normalized": false,
63
+ "rstrip": false,
64
+ "single_word": false,
65
+ "special": true
66
+ },
67
+ "8": {
68
+ "content": "tool",
69
+ "lstrip": false,
70
+ "normalized": false,
71
+ "rstrip": false,
72
+ "single_word": false,
73
+ "special": true
74
+ },
75
+ "9": {
76
+ "content": "<tools>",
77
+ "lstrip": false,
78
+ "normalized": false,
79
+ "rstrip": false,
80
+ "single_word": false,
81
+ "special": true
82
+ },
83
+ "10": {
84
+ "content": "</tools>",
85
+ "lstrip": false,
86
+ "normalized": false,
87
+ "rstrip": false,
88
+ "single_word": false,
89
+ "special": true
90
+ },
91
+ "11": {
92
+ "content": "<tool_call>",
93
+ "lstrip": false,
94
+ "normalized": false,
95
+ "rstrip": false,
96
+ "single_word": false,
97
+ "special": true
98
+ },
99
+ "12": {
100
+ "content": "</tool_call>",
101
+ "lstrip": false,
102
+ "normalized": false,
103
+ "rstrip": false,
104
+ "single_word": false,
105
+ "special": true
106
+ },
107
+ "13": {
108
+ "content": "<tool_response>",
109
+ "lstrip": false,
110
+ "normalized": false,
111
+ "rstrip": false,
112
+ "single_word": false,
113
+ "special": true
114
+ },
115
+ "14": {
116
+ "content": "</tool_response>",
117
+ "lstrip": false,
118
+ "normalized": false,
119
+ "rstrip": false,
120
+ "single_word": false,
121
+ "special": true
122
+ },
123
+ "15": {
124
+ "content": "\"arguments\"",
125
+ "lstrip": false,
126
+ "normalized": false,
127
+ "rstrip": false,
128
+ "single_word": false,
129
+ "special": true
130
+ },
131
+ "16": {
132
+ "content": "\"name\"",
133
+ "lstrip": false,
134
+ "normalized": false,
135
+ "rstrip": false,
136
+ "single_word": false,
137
+ "special": true
138
+ },
139
+ "17": {
140
+ "content": "<arguments>",
141
+ "lstrip": false,
142
+ "normalized": false,
143
+ "rstrip": false,
144
+ "single_word": false,
145
+ "special": true
146
+ },
147
+ "18": {
148
+ "content": "</arguments>",
149
+ "lstrip": false,
150
+ "normalized": false,
151
+ "rstrip": false,
152
+ "single_word": false,
153
+ "special": true
154
+ },
155
+ "19": {
156
+ "content": "<argument>",
157
+ "lstrip": false,
158
+ "normalized": false,
159
+ "rstrip": false,
160
+ "single_word": false,
161
+ "special": true
162
+ },
163
+ "20": {
164
+ "content": "</argument>",
165
+ "lstrip": false,
166
+ "normalized": false,
167
+ "rstrip": false,
168
+ "single_word": false,
169
+ "special": true
170
+ },
171
+ "21": {
172
+ "content": "<argument-name>",
173
+ "lstrip": false,
174
+ "normalized": false,
175
+ "rstrip": false,
176
+ "single_word": false,
177
+ "special": true
178
+ },
179
+ "22": {
180
+ "content": "</argument-name>",
181
+ "lstrip": false,
182
+ "normalized": false,
183
+ "rstrip": false,
184
+ "single_word": false,
185
+ "special": true
186
+ },
187
+ "23": {
188
+ "content": "<argument-type>",
189
+ "lstrip": false,
190
+ "normalized": false,
191
+ "rstrip": false,
192
+ "single_word": false,
193
+ "special": true
194
+ },
195
+ "24": {
196
+ "content": "</argument-type>",
197
+ "lstrip": false,
198
+ "normalized": false,
199
+ "rstrip": false,
200
+ "single_word": false,
201
+ "special": true
202
+ },
203
+ "25": {
204
+ "content": "<argument-value>",
205
+ "lstrip": false,
206
+ "normalized": false,
207
+ "rstrip": false,
208
+ "single_word": false,
209
+ "special": true
210
+ },
211
+ "26": {
212
+ "content": "</argument-value>",
213
+ "lstrip": false,
214
+ "normalized": false,
215
+ "rstrip": false,
216
+ "single_word": false,
217
+ "special": true
218
+ },
219
+ "27": {
220
+ "content": "<parameter>",
221
+ "lstrip": false,
222
+ "normalized": false,
223
+ "rstrip": false,
224
+ "single_word": false,
225
+ "special": true
226
+ },
227
+ "28": {
228
+ "content": "</parameter>",
229
+ "lstrip": false,
230
+ "normalized": false,
231
+ "rstrip": false,
232
+ "single_word": false,
233
+ "special": true
234
+ },
235
+ "29": {
236
+ "content": "<parameter-name>",
237
+ "lstrip": false,
238
+ "normalized": false,
239
+ "rstrip": false,
240
+ "single_word": false,
241
+ "special": true
242
+ },
243
+ "30": {
244
+ "content": "</parameter-name>",
245
+ "lstrip": false,
246
+ "normalized": false,
247
+ "rstrip": false,
248
+ "single_word": false,
249
+ "special": true
250
+ },
251
+ "31": {
252
+ "content": "<parameter-type>",
253
+ "lstrip": false,
254
+ "normalized": false,
255
+ "rstrip": false,
256
+ "single_word": false,
257
+ "special": true
258
+ },
259
+ "32": {
260
+ "content": "</parameter-type>",
261
+ "lstrip": false,
262
+ "normalized": false,
263
+ "rstrip": false,
264
+ "single_word": false,
265
+ "special": true
266
+ },
267
+ "33": {
268
+ "content": "<parameter-value>",
269
+ "lstrip": false,
270
+ "normalized": false,
271
+ "rstrip": false,
272
+ "single_word": false,
273
+ "special": true
274
+ },
275
+ "34": {
276
+ "content": "</parameter-value>",
277
+ "lstrip": false,
278
+ "normalized": false,
279
+ "rstrip": false,
280
+ "single_word": false,
281
+ "special": true
282
+ },
283
+ "35": {
284
+ "content": "<field>",
285
+ "lstrip": false,
286
+ "normalized": false,
287
+ "rstrip": false,
288
+ "single_word": false,
289
+ "special": true
290
+ },
291
+ "36": {
292
+ "content": "</field>",
293
+ "lstrip": false,
294
+ "normalized": false,
295
+ "rstrip": false,
296
+ "single_word": false,
297
+ "special": true
298
+ },
299
+ "37": {
300
+ "content": "<field-name>",
301
+ "lstrip": false,
302
+ "normalized": false,
303
+ "rstrip": false,
304
+ "single_word": false,
305
+ "special": true
306
+ },
307
+ "38": {
308
+ "content": "</field-name>",
309
+ "lstrip": false,
310
+ "normalized": false,
311
+ "rstrip": false,
312
+ "single_word": false,
313
+ "special": true
314
+ },
315
+ "39": {
316
+ "content": "<field-type>",
317
+ "lstrip": false,
318
+ "normalized": false,
319
+ "rstrip": false,
320
+ "single_word": false,
321
+ "special": true
322
+ },
323
+ "40": {
324
+ "content": "</field-type>",
325
+ "lstrip": false,
326
+ "normalized": false,
327
+ "rstrip": false,
328
+ "single_word": false,
329
+ "special": true
330
+ },
331
+ "41": {
332
+ "content": "<field-value>",
333
+ "lstrip": false,
334
+ "normalized": false,
335
+ "rstrip": false,
336
+ "single_word": false,
337
+ "special": true
338
+ },
339
+ "42": {
340
+ "content": "</field-value>",
341
+ "lstrip": false,
342
+ "normalized": false,
343
+ "rstrip": false,
344
+ "single_word": false,
345
+ "special": true
346
+ },
347
+ "43": {
348
+ "content": "<name>",
349
+ "lstrip": false,
350
+ "normalized": false,
351
+ "rstrip": false,
352
+ "single_word": false,
353
+ "special": true
354
+ },
355
+ "44": {
356
+ "content": "</name>",
357
+ "lstrip": false,
358
+ "normalized": false,
359
+ "rstrip": false,
360
+ "single_word": false,
361
+ "special": true
362
+ },
363
+ "45": {
364
+ "content": "<type>",
365
+ "lstrip": false,
366
+ "normalized": false,
367
+ "rstrip": false,
368
+ "single_word": false,
369
+ "special": true
370
+ },
371
+ "46": {
372
+ "content": "</type>",
373
+ "lstrip": false,
374
+ "normalized": false,
375
+ "rstrip": false,
376
+ "single_word": false,
377
+ "special": true
378
+ },
379
+ "47": {
380
+ "content": "<value>",
381
+ "lstrip": false,
382
+ "normalized": false,
383
+ "rstrip": false,
384
+ "single_word": false,
385
+ "special": true
386
+ },
387
+ "48": {
388
+ "content": "</value>",
389
+ "lstrip": false,
390
+ "normalized": false,
391
+ "rstrip": false,
392
+ "single_word": false,
393
+ "special": true
394
+ },
395
+ "49": {
396
+ "content": "<function>",
397
+ "lstrip": false,
398
+ "normalized": false,
399
+ "rstrip": false,
400
+ "single_word": false,
401
+ "special": true
402
+ },
403
+ "50": {
404
+ "content": "</function>",
405
+ "lstrip": false,
406
+ "normalized": false,
407
+ "rstrip": false,
408
+ "single_word": false,
409
+ "special": true
410
+ },
411
+ "51": {
412
+ "content": "<function-name>",
413
+ "lstrip": false,
414
+ "normalized": false,
415
+ "rstrip": false,
416
+ "single_word": false,
417
+ "special": true
418
+ },
419
+ "52": {
420
+ "content": "</function-name>",
421
+ "lstrip": false,
422
+ "normalized": false,
423
+ "rstrip": false,
424
+ "single_word": false,
425
+ "special": true
426
+ },
427
+ "53": {
428
+ "content": "<function-type>",
429
+ "lstrip": false,
430
+ "normalized": false,
431
+ "rstrip": false,
432
+ "single_word": false,
433
+ "special": true
434
+ },
435
+ "54": {
436
+ "content": "</function-type>",
437
+ "lstrip": false,
438
+ "normalized": false,
439
+ "rstrip": false,
440
+ "single_word": false,
441
+ "special": true
442
+ },
443
+ "55": {
444
+ "content": "<function-value>",
445
+ "lstrip": false,
446
+ "normalized": false,
447
+ "rstrip": false,
448
+ "single_word": false,
449
+ "special": true
450
+ },
451
+ "56": {
452
+ "content": "</function-value>",
453
+ "lstrip": false,
454
+ "normalized": false,
455
+ "rstrip": false,
456
+ "single_word": false,
457
+ "special": true
458
+ },
459
+ "57": {
460
+ "content": " ",
461
+ "lstrip": false,
462
+ "normalized": false,
463
+ "rstrip": false,
464
+ "single_word": false,
465
+ "special": true
466
+ },
467
+ "58": {
468
+ "content": " ",
469
+ "lstrip": false,
470
+ "normalized": false,
471
+ "rstrip": false,
472
+ "single_word": false,
473
+ "special": true
474
+ },
475
+ "59": {
476
+ "content": " ",
477
+ "lstrip": false,
478
+ "normalized": false,
479
+ "rstrip": false,
480
+ "single_word": false,
481
+ "special": true
482
+ },
483
+ "60": {
484
+ "content": " ",
485
+ "lstrip": false,
486
+ "normalized": false,
487
+ "rstrip": false,
488
+ "single_word": false,
489
+ "special": true
490
+ },
491
+ "61": {
492
+ "content": " ",
493
+ "lstrip": false,
494
+ "normalized": false,
495
+ "rstrip": false,
496
+ "single_word": false,
497
+ "special": true
498
+ },
499
+ "62": {
500
+ "content": " ",
501
+ "lstrip": false,
502
+ "normalized": false,
503
+ "rstrip": false,
504
+ "single_word": false,
505
+ "special": true
506
+ },
507
+ "63": {
508
+ "content": " ",
509
+ "lstrip": false,
510
+ "normalized": false,
511
+ "rstrip": false,
512
+ "single_word": false,
513
+ "special": true
514
+ },
515
+ "64": {
516
+ "content": " ",
517
+ "lstrip": false,
518
+ "normalized": false,
519
+ "rstrip": false,
520
+ "single_word": false,
521
+ "special": true
522
+ },
523
+ "65": {
524
+ "content": " ",
525
+ "lstrip": false,
526
+ "normalized": false,
527
+ "rstrip": false,
528
+ "single_word": false,
529
+ "special": true
530
+ },
531
+ "66": {
532
+ "content": " ",
533
+ "lstrip": false,
534
+ "normalized": false,
535
+ "rstrip": false,
536
+ "single_word": false,
537
+ "special": true
538
+ },
539
+ "67": {
540
+ "content": " ",
541
+ "lstrip": false,
542
+ "normalized": false,
543
+ "rstrip": false,
544
+ "single_word": false,
545
+ "special": true
546
+ },
547
+ "68": {
548
+ "content": " ",
549
+ "lstrip": false,
550
+ "normalized": false,
551
+ "rstrip": false,
552
+ "single_word": false,
553
+ "special": true
554
+ },
555
+ "69": {
556
+ "content": " ",
557
+ "lstrip": false,
558
+ "normalized": false,
559
+ "rstrip": false,
560
+ "single_word": false,
561
+ "special": true
562
+ },
563
+ "70": {
564
+ "content": " ",
565
+ "lstrip": false,
566
+ "normalized": false,
567
+ "rstrip": false,
568
+ "single_word": false,
569
+ "special": true
570
+ },
571
+ "71": {
572
+ "content": " ",
573
+ "lstrip": false,
574
+ "normalized": false,
575
+ "rstrip": false,
576
+ "single_word": false,
577
+ "special": true
578
+ },
579
+ "72": {
580
+ "content": " ",
581
+ "lstrip": false,
582
+ "normalized": false,
583
+ "rstrip": false,
584
+ "single_word": false,
585
+ "special": true
586
+ },
587
+ "73": {
588
+ "content": " ",
589
+ "lstrip": false,
590
+ "normalized": false,
591
+ "rstrip": false,
592
+ "single_word": false,
593
+ "special": true
594
+ },
595
+ "74": {
596
+ "content": " ",
597
+ "lstrip": false,
598
+ "normalized": false,
599
+ "rstrip": false,
600
+ "single_word": false,
601
+ "special": true
602
+ },
603
+ "75": {
604
+ "content": " ",
605
+ "lstrip": false,
606
+ "normalized": false,
607
+ "rstrip": false,
608
+ "single_word": false,
609
+ "special": true
610
+ },
611
+ "76": {
612
+ "content": " ",
613
+ "lstrip": false,
614
+ "normalized": false,
615
+ "rstrip": false,
616
+ "single_word": false,
617
+ "special": true
618
+ },
619
+ "77": {
620
+ "content": " ",
621
+ "lstrip": false,
622
+ "normalized": false,
623
+ "rstrip": false,
624
+ "single_word": false,
625
+ "special": true
626
+ },
627
+ "78": {
628
+ "content": " ",
629
+ "lstrip": false,
630
+ "normalized": false,
631
+ "rstrip": false,
632
+ "single_word": false,
633
+ "special": true
634
+ },
635
+ "79": {
636
+ "content": " ",
637
+ "lstrip": false,
638
+ "normalized": false,
639
+ "rstrip": false,
640
+ "single_word": false,
641
+ "special": true
642
+ },
643
+ "80": {
644
+ "content": "<|reserved_0|>",
645
+ "lstrip": false,
646
+ "normalized": false,
647
+ "rstrip": false,
648
+ "single_word": false,
649
+ "special": true
650
+ },
651
+ "81": {
652
+ "content": "<|reserved_1|>",
653
+ "lstrip": false,
654
+ "normalized": false,
655
+ "rstrip": false,
656
+ "single_word": false,
657
+ "special": true
658
+ },
659
+ "82": {
660
+ "content": "<|reserved_2|>",
661
+ "lstrip": false,
662
+ "normalized": false,
663
+ "rstrip": false,
664
+ "single_word": false,
665
+ "special": true
666
+ },
667
+ "83": {
668
+ "content": "<|reserved_3|>",
669
+ "lstrip": false,
670
+ "normalized": false,
671
+ "rstrip": false,
672
+ "single_word": false,
673
+ "special": true
674
+ },
675
+ "84": {
676
+ "content": "<|reserved_4|>",
677
+ "lstrip": false,
678
+ "normalized": false,
679
+ "rstrip": false,
680
+ "single_word": false,
681
+ "special": true
682
+ },
683
+ "85": {
684
+ "content": "<|reserved_5|>",
685
+ "lstrip": false,
686
+ "normalized": false,
687
+ "rstrip": false,
688
+ "single_word": false,
689
+ "special": true
690
+ },
691
+ "86": {
692
+ "content": "<|reserved_6|>",
693
+ "lstrip": false,
694
+ "normalized": false,
695
+ "rstrip": false,
696
+ "single_word": false,
697
+ "special": true
698
+ },
699
+ "87": {
700
+ "content": "<|reserved_7|>",
701
+ "lstrip": false,
702
+ "normalized": false,
703
+ "rstrip": false,
704
+ "single_word": false,
705
+ "special": true
706
+ },
707
+ "88": {
708
+ "content": "<|reserved_8|>",
709
+ "lstrip": false,
710
+ "normalized": false,
711
+ "rstrip": false,
712
+ "single_word": false,
713
+ "special": true
714
+ },
715
+ "89": {
716
+ "content": "<|reserved_9|>",
717
+ "lstrip": false,
718
+ "normalized": false,
719
+ "rstrip": false,
720
+ "single_word": false,
721
+ "special": true
722
+ },
723
+ "90": {
724
+ "content": "<|reserved_10|>",
725
+ "lstrip": false,
726
+ "normalized": false,
727
+ "rstrip": false,
728
+ "single_word": false,
729
+ "special": true
730
+ },
731
+ "91": {
732
+ "content": "<|reserved_11|>",
733
+ "lstrip": false,
734
+ "normalized": false,
735
+ "rstrip": false,
736
+ "single_word": false,
737
+ "special": true
738
+ },
739
+ "92": {
740
+ "content": "<|reserved_12|>",
741
+ "lstrip": false,
742
+ "normalized": false,
743
+ "rstrip": false,
744
+ "single_word": false,
745
+ "special": true
746
+ },
747
+ "93": {
748
+ "content": "<|reserved_13|>",
749
+ "lstrip": false,
750
+ "normalized": false,
751
+ "rstrip": false,
752
+ "single_word": false,
753
+ "special": true
754
+ },
755
+ "94": {
756
+ "content": "<|reserved_14|>",
757
+ "lstrip": false,
758
+ "normalized": false,
759
+ "rstrip": false,
760
+ "single_word": false,
761
+ "special": true
762
+ },
763
+ "95": {
764
+ "content": "<|reserved_15|>",
765
+ "lstrip": false,
766
+ "normalized": false,
767
+ "rstrip": false,
768
+ "single_word": false,
769
+ "special": true
770
+ },
771
+ "96": {
772
+ "content": "<|reserved_16|>",
773
+ "lstrip": false,
774
+ "normalized": false,
775
+ "rstrip": false,
776
+ "single_word": false,
777
+ "special": true
778
+ },
779
+ "97": {
780
+ "content": "<|reserved_17|>",
781
+ "lstrip": false,
782
+ "normalized": false,
783
+ "rstrip": false,
784
+ "single_word": false,
785
+ "special": true
786
+ },
787
+ "98": {
788
+ "content": "<|reserved_18|>",
789
+ "lstrip": false,
790
+ "normalized": false,
791
+ "rstrip": false,
792
+ "single_word": false,
793
+ "special": true
794
+ },
795
+ "99": {
796
+ "content": "<|reserved_19|>",
797
+ "lstrip": false,
798
+ "normalized": false,
799
+ "rstrip": false,
800
+ "single_word": false,
801
+ "special": true
802
+ },
803
+ "100": {
804
+ "content": "<|reserved_20|>",
805
+ "lstrip": false,
806
+ "normalized": false,
807
+ "rstrip": false,
808
+ "single_word": false,
809
+ "special": true
810
+ },
811
+ "101": {
812
+ "content": "<|reserved_21|>",
813
+ "lstrip": false,
814
+ "normalized": false,
815
+ "rstrip": false,
816
+ "single_word": false,
817
+ "special": true
818
+ },
819
+ "102": {
820
+ "content": "<|reserved_22|>",
821
+ "lstrip": false,
822
+ "normalized": false,
823
+ "rstrip": false,
824
+ "single_word": false,
825
+ "special": true
826
+ },
827
+ "103": {
828
+ "content": "<|reserved_23|>",
829
+ "lstrip": false,
830
+ "normalized": false,
831
+ "rstrip": false,
832
+ "single_word": false,
833
+ "special": true
834
+ },
835
+ "104": {
836
+ "content": "<|reserved_24|>",
837
+ "lstrip": false,
838
+ "normalized": false,
839
+ "rstrip": false,
840
+ "single_word": false,
841
+ "special": true
842
+ },
843
+ "105": {
844
+ "content": "<|reserved_25|>",
845
+ "lstrip": false,
846
+ "normalized": false,
847
+ "rstrip": false,
848
+ "single_word": false,
849
+ "special": true
850
+ },
851
+ "106": {
852
+ "content": "<|reserved_26|>",
853
+ "lstrip": false,
854
+ "normalized": false,
855
+ "rstrip": false,
856
+ "single_word": false,
857
+ "special": true
858
+ },
859
+ "107": {
860
+ "content": "<|reserved_27|>",
861
+ "lstrip": false,
862
+ "normalized": false,
863
+ "rstrip": false,
864
+ "single_word": false,
865
+ "special": true
866
+ },
867
+ "108": {
868
+ "content": "<|reserved_28|>",
869
+ "lstrip": false,
870
+ "normalized": false,
871
+ "rstrip": false,
872
+ "single_word": false,
873
+ "special": true
874
+ },
875
+ "109": {
876
+ "content": "<|reserved_29|>",
877
+ "lstrip": false,
878
+ "normalized": false,
879
+ "rstrip": false,
880
+ "single_word": false,
881
+ "special": true
882
+ },
883
+ "110": {
884
+ "content": "<|reserved_30|>",
885
+ "lstrip": false,
886
+ "normalized": false,
887
+ "rstrip": false,
888
+ "single_word": false,
889
+ "special": true
890
+ },
891
+ "111": {
892
+ "content": "<|reserved_31|>",
893
+ "lstrip": false,
894
+ "normalized": false,
895
+ "rstrip": false,
896
+ "single_word": false,
897
+ "special": true
898
+ },
899
+ "112": {
900
+ "content": "<|reserved_32|>",
901
+ "lstrip": false,
902
+ "normalized": false,
903
+ "rstrip": false,
904
+ "single_word": false,
905
+ "special": true
906
+ },
907
+ "113": {
908
+ "content": "<|reserved_33|>",
909
+ "lstrip": false,
910
+ "normalized": false,
911
+ "rstrip": false,
912
+ "single_word": false,
913
+ "special": true
914
+ },
915
+ "114": {
916
+ "content": "<|reserved_34|>",
917
+ "lstrip": false,
918
+ "normalized": false,
919
+ "rstrip": false,
920
+ "single_word": false,
921
+ "special": true
922
+ },
923
+ "115": {
924
+ "content": "<|reserved_35|>",
925
+ "lstrip": false,
926
+ "normalized": false,
927
+ "rstrip": false,
928
+ "single_word": false,
929
+ "special": true
930
+ },
931
+ "116": {
932
+ "content": "<|reserved_36|>",
933
+ "lstrip": false,
934
+ "normalized": false,
935
+ "rstrip": false,
936
+ "single_word": false,
937
+ "special": true
938
+ },
939
+ "117": {
940
+ "content": "<|reserved_37|>",
941
+ "lstrip": false,
942
+ "normalized": false,
943
+ "rstrip": false,
944
+ "single_word": false,
945
+ "special": true
946
+ },
947
+ "118": {
948
+ "content": "<|reserved_38|>",
949
+ "lstrip": false,
950
+ "normalized": false,
951
+ "rstrip": false,
952
+ "single_word": false,
953
+ "special": true
954
+ },
955
+ "119": {
956
+ "content": "<|reserved_39|>",
957
+ "lstrip": false,
958
+ "normalized": false,
959
+ "rstrip": false,
960
+ "single_word": false,
961
+ "special": true
962
+ },
963
+ "120": {
964
+ "content": "<|reserved_40|>",
965
+ "lstrip": false,
966
+ "normalized": false,
967
+ "rstrip": false,
968
+ "single_word": false,
969
+ "special": true
970
+ },
971
+ "121": {
972
+ "content": "<|reserved_41|>",
973
+ "lstrip": false,
974
+ "normalized": false,
975
+ "rstrip": false,
976
+ "single_word": false,
977
+ "special": true
978
+ },
979
+ "122": {
980
+ "content": "<|reserved_42|>",
981
+ "lstrip": false,
982
+ "normalized": false,
983
+ "rstrip": false,
984
+ "single_word": false,
985
+ "special": true
986
+ },
987
+ "123": {
988
+ "content": "<|reserved_43|>",
989
+ "lstrip": false,
990
+ "normalized": false,
991
+ "rstrip": false,
992
+ "single_word": false,
993
+ "special": true
994
+ },
995
+ "124": {
996
+ "content": "<|reserved_44|>",
997
+ "lstrip": false,
998
+ "normalized": false,
999
+ "rstrip": false,
1000
+ "single_word": false,
1001
+ "special": true
1002
+ },
1003
+ "125": {
1004
+ "content": "<|reserved_45|>",
1005
+ "lstrip": false,
1006
+ "normalized": false,
1007
+ "rstrip": false,
1008
+ "single_word": false,
1009
+ "special": true
1010
+ },
1011
+ "126": {
1012
+ "content": "<|reserved_46|>",
1013
+ "lstrip": false,
1014
+ "normalized": false,
1015
+ "rstrip": false,
1016
+ "single_word": false,
1017
+ "special": true
1018
+ },
1019
+ "127": {
1020
+ "content": "<|reserved_47|>",
1021
+ "lstrip": false,
1022
+ "normalized": false,
1023
+ "rstrip": false,
1024
+ "single_word": false,
1025
+ "special": true
1026
+ }
1027
+ },
1028
+ "bos_token": "<s>",
1029
+ "chat_template": "{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
1030
+ "clean_up_tokenization_spaces": false,
1031
+ "eos_token": "</s>",
1032
+ "model_max_length": 1000000000000000019884624838656,
1033
+ "pad_token": "</s>",
1034
+ "tokenizer_class": "PreTrainedTokenizerFast",
1035
+ "unk_token": "<unk>"
1036
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff