-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Closed
Labels
solvedThis problem has been already solvedThis problem has been already solved
Description
Reminder
- I have read the above rules and searched the existing issues.
System Info
INFO 02-26 15:55:11 init.py:190] Automatically detected platform cuda.
llamafactoryversion: 0.9.2.dev0- Platform: Linux-5.15.0-91-generic-x86_64-with-glibc2.35
- Python version: 3.11.0
- PyTorch version: 2.5.1+cu124 (GPU)
- Transformers version: 4.49.0
- Datasets version: 3.2.0
- Accelerate version: 1.2.1
- PEFT version: 0.12.0
- TRL version: 0.9.6
- DeepSpeed version: 0.16.2
- vLLM version: 0.7.2
Reproduction
Put your message here.
我的数据集为包含近1000条,输出格式为 **<...>.....</...>....**的数据,想通过微调Qwen模型使其能够输出<...>标签,直接进行微调的已经尝试过,现在需要将<...>作为special token的形式进行微调,微调结束并将模型合并之后进行推理,结果中并没有包含<...>标签,参考#6630 和 #6749 等方法尝试无果,因此来咨询一下,希望能得到您的回复。
训练过程
训练代码:llamafactory-cli train examples/train_lora/deepseek_v3.yaml
具体的配置文件如下:
### model
model_name_or_path: /data/models/Qwen2.5-1.5B-Instruct
stage: sft
do_train: true
finetuning_type: lora
lora_target: all
deepspeed: ./examples/deepspeed/ds_z3_config.json
# lora_rank: 16
# lora_alpha: 32
dataset: deepseek750_v1
template: qwen
packing: false
cutoff_len: 32768
overwrite_cache: true
preprocessing_num_workers: 16
output_dir: ./saves/qwen2.5-1.5B_v3/
logging_steps: 1
save_steps: 30
plot_loss: true
overwrite_output_dir: true
per_device_train_batch_size: 1
gradient_accumulation_steps: 2
learning_rate: 5.00e-5
num_train_epochs: 7
lr_scheduler_type: cosine
warmup_ratio: 0.1
bf16: true
new_special_tokens: "<think>,</think>"
skip_special_tokens: false
merge过程
训练代码:llamafactory-cli export examples/merge_lora/qwen_deep_v3.yaml
具体的配置文件如下:
### model
model_name_or_path: /data/models/Qwen2.5-1.5B-Instruct
adapter_name_or_path: ./saves/qwen2.5-1.5B_v3
template: qwen
trust_remote_code: true
new_special_tokens: "<think>,</think>"
skip_special_tokens: false
### export
export_dir: output/deep_1.5_merge_v3
export_size: 1
export_device: auto
export_legacy_format: false
推理过程
推理代码:CUDA_VISIBLE_DEVICES=0,1,2,3 python scripts/vllm_infer.py --model_name_or_path ./output/deep_1.5_merge_v3 --dataset deepseek750_dev
推理结果中 只有这个标签"label": "<|im_end|>\n"
也参照一些issue通过调参等方式进一步尝试,但依旧不会输出special token
麻烦占用您的一部分时间,指点一下我该如何去修改,才能让微调之后的模型能够准确地输出special_token
Others
No response
Metadata
Metadata
Assignees
Labels
solvedThis problem has been already solvedThis problem has been already solved