llama2-7b微调tokenizer_config.json中没有chat_template #2831
Description
model_name=llama2-7b
dataset_name=sharegpt
gpu_id=7
CUDA_VISIBLE_DEVICES=${gpu_id}
nohup swift sft
--model_type ${model_name}
--model_id_or_path /fs/archive/share/ckp/llama2/origin/llama2-7b
--model_revision master
--sft_type full
--tuner_backend swift
--template_type llama
--dtype AUTO
--output_dir /fs/archive/share/ckp/llama2/base/sharegpt
--dataset /home/Datasets/sharegpt.jsonl
--train_dataset_sample -1
--num_train_epochs 3
--max_length 4096
--check_dataset_strategy warning
--gradient_checkpointing true
--batch_size 1
--weight_decay 0.01
--learning_rate 2e-5
--gradient_accumulation_steps 16
--max_grad_norm 0.5
--warmup_ratio 0.03
--eval_steps 100
--save_steps 2000
--save_total_limit 3
--logging_steps 10
--use_flash_attn false
使用apply_chat_template 时报错:
ValueError: Cannot use chat template functions because tokenizer.chat_template is not set and no template argument was passed! For information about writing templates and setting the tokenizer.chat_template attribute, please see the documentation at https://huggingface.co/docs/transformers/main/en/chat_templating
去微调后的模型文件看了一下tokenizer_config并没有chat_template,请问是什么原因呢?按理来说是llama的template?