Upload folder using huggingface_hub
Browse files- added_tokens.json +13 -0
- config.json +3 -3
- generation_config.json +1 -1
- model.safetensors +1 -1
- sample_finetune.py +214 -0
- special_tokens_map.json +30 -30
- tokenizer.json +0 -0
- tokenizer.model +3 -0
- tokenizer_config.json +130 -131
added_tokens.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"<|endoftext|>": 32000,
|
| 3 |
+
"<|assistant|>": 32001,
|
| 4 |
+
"<|placeholder1|>": 32002,
|
| 5 |
+
"<|placeholder2|>": 32003,
|
| 6 |
+
"<|placeholder3|>": 32004,
|
| 7 |
+
"<|placeholder4|>": 32005,
|
| 8 |
+
"<|system|>": 32006,
|
| 9 |
+
"<|end|>": 32007,
|
| 10 |
+
"<|placeholder5|>": 32008,
|
| 11 |
+
"<|placeholder6|>": 32009,
|
| 12 |
+
"<|user|>": 32010
|
| 13 |
+
}
|
config.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"_name_or_path": "/
|
| 3 |
"architectures": [
|
| 4 |
"Phi3ForCausalLM"
|
| 5 |
],
|
|
@@ -41,7 +41,7 @@
|
|
| 41 |
"quantization_status": "frozen",
|
| 42 |
"sparsity_config": {
|
| 43 |
"format": "dense",
|
| 44 |
-
"global_sparsity":
|
| 45 |
"registry_requires_subclass": false,
|
| 46 |
"sparsity_structure": "unstructured"
|
| 47 |
}
|
|
@@ -168,7 +168,7 @@
|
|
| 168 |
"sliding_window": 262144,
|
| 169 |
"tie_word_embeddings": false,
|
| 170 |
"torch_dtype": "bfloat16",
|
| 171 |
-
"transformers_version": "4.
|
| 172 |
"use_cache": true,
|
| 173 |
"vocab_size": 32064
|
| 174 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"_name_or_path": "/home/abhinav/.cache/huggingface/hub/models--microsoft--Phi-3-mini-128k-instruct/snapshots/d548c233192db00165d842bf8edff054bb3212f8",
|
| 3 |
"architectures": [
|
| 4 |
"Phi3ForCausalLM"
|
| 5 |
],
|
|
|
|
| 41 |
"quantization_status": "frozen",
|
| 42 |
"sparsity_config": {
|
| 43 |
"format": "dense",
|
| 44 |
+
"global_sparsity": 0.15005534813239688,
|
| 45 |
"registry_requires_subclass": false,
|
| 46 |
"sparsity_structure": "unstructured"
|
| 47 |
}
|
|
|
|
| 168 |
"sliding_window": 262144,
|
| 169 |
"tie_word_embeddings": false,
|
| 170 |
"torch_dtype": "bfloat16",
|
| 171 |
+
"transformers_version": "4.43.3",
|
| 172 |
"use_cache": true,
|
| 173 |
"vocab_size": 32064
|
| 174 |
}
|
generation_config.json
CHANGED
|
@@ -7,5 +7,5 @@
|
|
| 7 |
32007
|
| 8 |
],
|
| 9 |
"pad_token_id": 32000,
|
| 10 |
-
"transformers_version": "4.
|
| 11 |
}
|
|
|
|
| 7 |
32007
|
| 8 |
],
|
| 9 |
"pad_token_id": 32000,
|
| 10 |
+
"transformers_version": "4.43.3"
|
| 11 |
}
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 2263018168
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b4c4857acdd8136550e0d3ff856562cd3a45712b453f224f480ba7e80c961bc4
|
| 3 |
size 2263018168
|
sample_finetune.py
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
import logging
|
| 3 |
+
|
| 4 |
+
import datasets
|
| 5 |
+
from datasets import load_dataset
|
| 6 |
+
from peft import LoraConfig
|
| 7 |
+
import torch
|
| 8 |
+
import transformers
|
| 9 |
+
from trl import SFTTrainer
|
| 10 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TrainingArguments, BitsAndBytesConfig
|
| 11 |
+
|
| 12 |
+
"""
|
| 13 |
+
A simple example on using SFTTrainer and Accelerate to finetune Phi-3 models. For
|
| 14 |
+
a more advanced example, please follow HF alignment-handbook/scripts/run_sft.py.
|
| 15 |
+
This example has utilized DeepSpeed ZeRO3 offload to reduce the memory usage. The
|
| 16 |
+
script can be run on V100 or later generation GPUs. Here are some suggestions on
|
| 17 |
+
futher reducing memory consumption:
|
| 18 |
+
- reduce batch size
|
| 19 |
+
- decrease lora dimension
|
| 20 |
+
- restrict lora target modules
|
| 21 |
+
Please follow these steps to run the script:
|
| 22 |
+
1. Install dependencies:
|
| 23 |
+
conda install -c conda-forge accelerate
|
| 24 |
+
pip3 install -i https://pypi.org/simple/ bitsandbytes
|
| 25 |
+
pip3 install peft transformers trl datasets
|
| 26 |
+
pip3 install deepspeed
|
| 27 |
+
2. Setup accelerate and deepspeed config based on the machine used:
|
| 28 |
+
accelerate config
|
| 29 |
+
Here is a sample config for deepspeed zero3:
|
| 30 |
+
compute_environment: LOCAL_MACHINE
|
| 31 |
+
debug: false
|
| 32 |
+
deepspeed_config:
|
| 33 |
+
gradient_accumulation_steps: 1
|
| 34 |
+
offload_optimizer_device: none
|
| 35 |
+
offload_param_device: none
|
| 36 |
+
zero3_init_flag: true
|
| 37 |
+
zero3_save_16bit_model: true
|
| 38 |
+
zero_stage: 3
|
| 39 |
+
distributed_type: DEEPSPEED
|
| 40 |
+
downcast_bf16: 'no'
|
| 41 |
+
enable_cpu_affinity: false
|
| 42 |
+
machine_rank: 0
|
| 43 |
+
main_training_function: main
|
| 44 |
+
mixed_precision: bf16
|
| 45 |
+
num_machines: 1
|
| 46 |
+
num_processes: 4
|
| 47 |
+
rdzv_backend: static
|
| 48 |
+
same_network: true
|
| 49 |
+
tpu_env: []
|
| 50 |
+
tpu_use_cluster: false
|
| 51 |
+
tpu_use_sudo: false
|
| 52 |
+
use_cpu: false
|
| 53 |
+
3. check accelerate config:
|
| 54 |
+
accelerate env
|
| 55 |
+
4. Run the code:
|
| 56 |
+
accelerate launch sample_finetune.py
|
| 57 |
+
"""
|
| 58 |
+
|
| 59 |
+
logger = logging.getLogger(__name__)
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
###################
|
| 63 |
+
# Hyper-parameters
|
| 64 |
+
###################
|
| 65 |
+
training_config = {
|
| 66 |
+
"bf16": True,
|
| 67 |
+
"do_eval": False,
|
| 68 |
+
"learning_rate": 5.0e-06,
|
| 69 |
+
"log_level": "info",
|
| 70 |
+
"logging_steps": 20,
|
| 71 |
+
"logging_strategy": "steps",
|
| 72 |
+
"lr_scheduler_type": "cosine",
|
| 73 |
+
"num_train_epochs": 1,
|
| 74 |
+
"max_steps": -1,
|
| 75 |
+
"output_dir": "./checkpoint_dir",
|
| 76 |
+
"overwrite_output_dir": True,
|
| 77 |
+
"per_device_eval_batch_size": 4,
|
| 78 |
+
"per_device_train_batch_size": 4,
|
| 79 |
+
"remove_unused_columns": True,
|
| 80 |
+
"save_steps": 100,
|
| 81 |
+
"save_total_limit": 1,
|
| 82 |
+
"seed": 0,
|
| 83 |
+
"gradient_checkpointing": True,
|
| 84 |
+
"gradient_checkpointing_kwargs":{"use_reentrant": False},
|
| 85 |
+
"gradient_accumulation_steps": 1,
|
| 86 |
+
"warmup_ratio": 0.2,
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
peft_config = {
|
| 90 |
+
"r": 16,
|
| 91 |
+
"lora_alpha": 32,
|
| 92 |
+
"lora_dropout": 0.05,
|
| 93 |
+
"bias": "none",
|
| 94 |
+
"task_type": "CAUSAL_LM",
|
| 95 |
+
"target_modules": "all-linear",
|
| 96 |
+
"modules_to_save": None,
|
| 97 |
+
}
|
| 98 |
+
train_conf = TrainingArguments(**training_config)
|
| 99 |
+
peft_conf = LoraConfig(**peft_config)
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
###############
|
| 103 |
+
# Setup logging
|
| 104 |
+
###############
|
| 105 |
+
logging.basicConfig(
|
| 106 |
+
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
|
| 107 |
+
datefmt="%Y-%m-%d %H:%M:%S",
|
| 108 |
+
handlers=[logging.StreamHandler(sys.stdout)],
|
| 109 |
+
)
|
| 110 |
+
log_level = train_conf.get_process_log_level()
|
| 111 |
+
logger.setLevel(log_level)
|
| 112 |
+
datasets.utils.logging.set_verbosity(log_level)
|
| 113 |
+
transformers.utils.logging.set_verbosity(log_level)
|
| 114 |
+
transformers.utils.logging.enable_default_handler()
|
| 115 |
+
transformers.utils.logging.enable_explicit_format()
|
| 116 |
+
|
| 117 |
+
# Log on each process a small summary
|
| 118 |
+
logger.warning(
|
| 119 |
+
f"Process rank: {train_conf.local_rank}, device: {train_conf.device}, n_gpu: {train_conf.n_gpu}"
|
| 120 |
+
+ f" distributed training: {bool(train_conf.local_rank != -1)}, 16-bits training: {train_conf.fp16}"
|
| 121 |
+
)
|
| 122 |
+
logger.info(f"Training/evaluation parameters {train_conf}")
|
| 123 |
+
logger.info(f"PEFT parameters {peft_conf}")
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
################
|
| 127 |
+
# Model Loading
|
| 128 |
+
################
|
| 129 |
+
# checkpoint_path = "microsoft/Phi-3-mini-4k-instruct"
|
| 130 |
+
checkpoint_path = "microsoft/Phi-3-mini-128k-instruct"
|
| 131 |
+
model_kwargs = dict(
|
| 132 |
+
use_cache=False,
|
| 133 |
+
trust_remote_code=True,
|
| 134 |
+
attn_implementation="flash_attention_2", # loading the model with flash-attenstion support
|
| 135 |
+
torch_dtype=torch.bfloat16,
|
| 136 |
+
device_map=None
|
| 137 |
+
)
|
| 138 |
+
model = AutoModelForCausalLM.from_pretrained(checkpoint_path, **model_kwargs)
|
| 139 |
+
tokenizer = AutoTokenizer.from_pretrained(checkpoint_path)
|
| 140 |
+
tokenizer.model_max_length = 2048
|
| 141 |
+
tokenizer.pad_token = tokenizer.unk_token # use unk rather than eos token to prevent endless generation
|
| 142 |
+
tokenizer.pad_token_id = tokenizer.convert_tokens_to_ids(tokenizer.pad_token)
|
| 143 |
+
tokenizer.padding_side = 'right'
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
##################
|
| 147 |
+
# Data Processing
|
| 148 |
+
##################
|
| 149 |
+
def apply_chat_template(
|
| 150 |
+
example,
|
| 151 |
+
tokenizer,
|
| 152 |
+
):
|
| 153 |
+
messages = example["messages"]
|
| 154 |
+
example["text"] = tokenizer.apply_chat_template(
|
| 155 |
+
messages, tokenize=False, add_generation_prompt=False)
|
| 156 |
+
return example
|
| 157 |
+
|
| 158 |
+
raw_dataset = load_dataset("HuggingFaceH4/ultrachat_200k")
|
| 159 |
+
train_dataset = raw_dataset["train_sft"]
|
| 160 |
+
test_dataset = raw_dataset["test_sft"]
|
| 161 |
+
column_names = list(train_dataset.features)
|
| 162 |
+
|
| 163 |
+
processed_train_dataset = train_dataset.map(
|
| 164 |
+
apply_chat_template,
|
| 165 |
+
fn_kwargs={"tokenizer": tokenizer},
|
| 166 |
+
num_proc=10,
|
| 167 |
+
remove_columns=column_names,
|
| 168 |
+
desc="Applying chat template to train_sft",
|
| 169 |
+
)
|
| 170 |
+
|
| 171 |
+
processed_test_dataset = test_dataset.map(
|
| 172 |
+
apply_chat_template,
|
| 173 |
+
fn_kwargs={"tokenizer": tokenizer},
|
| 174 |
+
num_proc=10,
|
| 175 |
+
remove_columns=column_names,
|
| 176 |
+
desc="Applying chat template to test_sft",
|
| 177 |
+
)
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
###########
|
| 181 |
+
# Training
|
| 182 |
+
###########
|
| 183 |
+
trainer = SFTTrainer(
|
| 184 |
+
model=model,
|
| 185 |
+
args=train_conf,
|
| 186 |
+
peft_config=peft_conf,
|
| 187 |
+
train_dataset=processed_train_dataset,
|
| 188 |
+
eval_dataset=processed_test_dataset,
|
| 189 |
+
max_seq_length=2048,
|
| 190 |
+
dataset_text_field="text",
|
| 191 |
+
tokenizer=tokenizer,
|
| 192 |
+
packing=True
|
| 193 |
+
)
|
| 194 |
+
train_result = trainer.train()
|
| 195 |
+
metrics = train_result.metrics
|
| 196 |
+
trainer.log_metrics("train", metrics)
|
| 197 |
+
trainer.save_metrics("train", metrics)
|
| 198 |
+
trainer.save_state()
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
#############
|
| 202 |
+
# Evaluation
|
| 203 |
+
#############
|
| 204 |
+
tokenizer.padding_side = 'left'
|
| 205 |
+
metrics = trainer.evaluate()
|
| 206 |
+
metrics["eval_samples"] = len(processed_test_dataset)
|
| 207 |
+
trainer.log_metrics("eval", metrics)
|
| 208 |
+
trainer.save_metrics("eval", metrics)
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
# ############
|
| 212 |
+
# # Save model
|
| 213 |
+
# ############
|
| 214 |
+
trainer.save_model(train_conf.output_dir)
|
special_tokens_map.json
CHANGED
|
@@ -1,30 +1,30 @@
|
|
| 1 |
-
{
|
| 2 |
-
"bos_token": {
|
| 3 |
-
"content": "<s>",
|
| 4 |
-
"lstrip": false,
|
| 5 |
-
"normalized": false,
|
| 6 |
-
"rstrip": false,
|
| 7 |
-
"single_word": false
|
| 8 |
-
},
|
| 9 |
-
"eos_token": {
|
| 10 |
-
"content": "<|endoftext|>",
|
| 11 |
-
"lstrip": false,
|
| 12 |
-
"normalized": false,
|
| 13 |
-
"rstrip": false,
|
| 14 |
-
"single_word": false
|
| 15 |
-
},
|
| 16 |
-
"pad_token": {
|
| 17 |
-
"content": "<|endoftext|>",
|
| 18 |
-
"lstrip": false,
|
| 19 |
-
"normalized": false,
|
| 20 |
-
"rstrip": false,
|
| 21 |
-
"single_word": false
|
| 22 |
-
},
|
| 23 |
-
"unk_token": {
|
| 24 |
-
"content": "<unk>",
|
| 25 |
-
"lstrip": false,
|
| 26 |
-
"normalized": false,
|
| 27 |
-
"rstrip": false,
|
| 28 |
-
"single_word": false
|
| 29 |
-
}
|
| 30 |
-
}
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "<|endoftext|>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "<|endoftext|>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"unk_token": {
|
| 24 |
+
"content": "<unk>",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
}
|
| 30 |
+
}
|
tokenizer.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347
|
| 3 |
+
size 499723
|
tokenizer_config.json
CHANGED
|
@@ -1,131 +1,130 @@
|
|
| 1 |
-
{
|
| 2 |
-
"add_bos_token": false,
|
| 3 |
-
"add_eos_token": false,
|
| 4 |
-
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|
| 96 |
-
"
|
| 97 |
-
"
|
| 98 |
-
"
|
| 99 |
-
"
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
"
|
| 104 |
-
"
|
| 105 |
-
"
|
| 106 |
-
"
|
| 107 |
-
"
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
"
|
| 112 |
-
"
|
| 113 |
-
"
|
| 114 |
-
"
|
| 115 |
-
"
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
"
|
| 120 |
-
"
|
| 121 |
-
"
|
| 122 |
-
"
|
| 123 |
-
"
|
| 124 |
-
"
|
| 125 |
-
"
|
| 126 |
-
"
|
| 127 |
-
"
|
| 128 |
-
"
|
| 129 |
-
"
|
| 130 |
-
|
| 131 |
-
}
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": false,
|
| 3 |
+
"add_eos_token": false,
|
| 4 |
+
"added_tokens_decoder": {
|
| 5 |
+
"0": {
|
| 6 |
+
"content": "<unk>",
|
| 7 |
+
"lstrip": false,
|
| 8 |
+
"normalized": false,
|
| 9 |
+
"rstrip": false,
|
| 10 |
+
"single_word": false,
|
| 11 |
+
"special": true
|
| 12 |
+
},
|
| 13 |
+
"1": {
|
| 14 |
+
"content": "<s>",
|
| 15 |
+
"lstrip": false,
|
| 16 |
+
"normalized": false,
|
| 17 |
+
"rstrip": false,
|
| 18 |
+
"single_word": false,
|
| 19 |
+
"special": true
|
| 20 |
+
},
|
| 21 |
+
"2": {
|
| 22 |
+
"content": "</s>",
|
| 23 |
+
"lstrip": false,
|
| 24 |
+
"normalized": false,
|
| 25 |
+
"rstrip": true,
|
| 26 |
+
"single_word": false,
|
| 27 |
+
"special": false
|
| 28 |
+
},
|
| 29 |
+
"32000": {
|
| 30 |
+
"content": "<|endoftext|>",
|
| 31 |
+
"lstrip": false,
|
| 32 |
+
"normalized": false,
|
| 33 |
+
"rstrip": false,
|
| 34 |
+
"single_word": false,
|
| 35 |
+
"special": true
|
| 36 |
+
},
|
| 37 |
+
"32001": {
|
| 38 |
+
"content": "<|assistant|>",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": false,
|
| 41 |
+
"rstrip": true,
|
| 42 |
+
"single_word": false,
|
| 43 |
+
"special": true
|
| 44 |
+
},
|
| 45 |
+
"32002": {
|
| 46 |
+
"content": "<|placeholder1|>",
|
| 47 |
+
"lstrip": false,
|
| 48 |
+
"normalized": false,
|
| 49 |
+
"rstrip": true,
|
| 50 |
+
"single_word": false,
|
| 51 |
+
"special": true
|
| 52 |
+
},
|
| 53 |
+
"32003": {
|
| 54 |
+
"content": "<|placeholder2|>",
|
| 55 |
+
"lstrip": false,
|
| 56 |
+
"normalized": false,
|
| 57 |
+
"rstrip": true,
|
| 58 |
+
"single_word": false,
|
| 59 |
+
"special": true
|
| 60 |
+
},
|
| 61 |
+
"32004": {
|
| 62 |
+
"content": "<|placeholder3|>",
|
| 63 |
+
"lstrip": false,
|
| 64 |
+
"normalized": false,
|
| 65 |
+
"rstrip": true,
|
| 66 |
+
"single_word": false,
|
| 67 |
+
"special": true
|
| 68 |
+
},
|
| 69 |
+
"32005": {
|
| 70 |
+
"content": "<|placeholder4|>",
|
| 71 |
+
"lstrip": false,
|
| 72 |
+
"normalized": false,
|
| 73 |
+
"rstrip": true,
|
| 74 |
+
"single_word": false,
|
| 75 |
+
"special": true
|
| 76 |
+
},
|
| 77 |
+
"32006": {
|
| 78 |
+
"content": "<|system|>",
|
| 79 |
+
"lstrip": false,
|
| 80 |
+
"normalized": false,
|
| 81 |
+
"rstrip": true,
|
| 82 |
+
"single_word": false,
|
| 83 |
+
"special": true
|
| 84 |
+
},
|
| 85 |
+
"32007": {
|
| 86 |
+
"content": "<|end|>",
|
| 87 |
+
"lstrip": false,
|
| 88 |
+
"normalized": false,
|
| 89 |
+
"rstrip": true,
|
| 90 |
+
"single_word": false,
|
| 91 |
+
"special": true
|
| 92 |
+
},
|
| 93 |
+
"32008": {
|
| 94 |
+
"content": "<|placeholder5|>",
|
| 95 |
+
"lstrip": false,
|
| 96 |
+
"normalized": false,
|
| 97 |
+
"rstrip": true,
|
| 98 |
+
"single_word": false,
|
| 99 |
+
"special": true
|
| 100 |
+
},
|
| 101 |
+
"32009": {
|
| 102 |
+
"content": "<|placeholder6|>",
|
| 103 |
+
"lstrip": false,
|
| 104 |
+
"normalized": false,
|
| 105 |
+
"rstrip": true,
|
| 106 |
+
"single_word": false,
|
| 107 |
+
"special": true
|
| 108 |
+
},
|
| 109 |
+
"32010": {
|
| 110 |
+
"content": "<|user|>",
|
| 111 |
+
"lstrip": false,
|
| 112 |
+
"normalized": false,
|
| 113 |
+
"rstrip": true,
|
| 114 |
+
"single_word": false,
|
| 115 |
+
"special": true
|
| 116 |
+
}
|
| 117 |
+
},
|
| 118 |
+
"bos_token": "<s>",
|
| 119 |
+
"chat_template": "{% for message in messages %}{% if message['role'] == 'system' %}{{'<|system|>\n' + message['content'] + '<|end|>\n'}}{% elif message['role'] == 'user' %}{{'<|user|>\n' + message['content'] + '<|end|>\n'}}{% elif message['role'] == 'assistant' %}{{'<|assistant|>\n' + message['content'] + '<|end|>\n'}}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ '<|assistant|>\n' }}{% else %}{{ eos_token }}{% endif %}",
|
| 120 |
+
"clean_up_tokenization_spaces": false,
|
| 121 |
+
"eos_token": "<|endoftext|>",
|
| 122 |
+
"legacy": false,
|
| 123 |
+
"model_max_length": 131072,
|
| 124 |
+
"pad_token": "<|endoftext|>",
|
| 125 |
+
"padding_side": "left",
|
| 126 |
+
"sp_model_kwargs": {},
|
| 127 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 128 |
+
"unk_token": "<unk>",
|
| 129 |
+
"use_default_system_prompt": false
|
| 130 |
+
}
|
|
|