Closed Betty-J closed 4 days ago
设置do_sample false的时候, 你是不是还设置了temperature 0.1
设置do_sample false的时候, 你是不是还设置了temperature 0.1
并没有设置temperature参数,它是默认的None,而且我在微调后的模型配置文件中发现temperature对应的实际数值是1.0。
这是我完整的finetune设置
SIZE_FACTOR=8 MAX_PIXELS=602112 CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 NPROC_PER_NODE=8 swift sft \
--model_type qwen2-vl-2b-instruct \
--model_id_or_path ./Qwen2-VL-2B-Instruct \
--sft_type lora \
--tuner_backend peft \
--sequence_parallel_size 1 \
--template_type AUTO \
--dtype bf16 \
--seed 42 \
--output_dir ./20241021 \
--dataset train \
--val_dataset val \
--num_train_epochs 50 \
--max_length 2048 \
--system 'You are a helpful assistant.' \
--check_dataset_strategy warning \
--lora_rank 32 \
--lora_alpha 32 \
--lora_dtype bf16 \
--lora_lr_ratio 16.0 \
--lora_target_modules ALL \
--gradient_checkpointing true \
--batch_size 1 \
--weight_decay 0.1 \
--gradient_accumulation_steps 16 \
--warmup_ratio 0.05 \
--eval_steps 200 \
--save_steps 200 \
--save_total_limit 3 \
--logging_steps 5 \
--learning_rate 4e-5 \
--use_flash_attn true \
--do_sample false \
加载这个微调后的模型进行推理时报了上述ValueError,infer中也设置了 --do_sample false
那 0.1是哪来的呢
那 0.1是哪来的呢
没定位到哪里设置的,没有显式设置,而且为什么设置--do_sample false 会出现 temperature 1.0 呢
那 0.1是哪来的呢
没定位到哪里设置的,没有显式设置,而且为什么设置--do_sample false 会出现 temperature 1.0 呢
不设置会出现警告的
当do_sample为false, 会将temperature设置为默认值, 来避免出现警告
当do_sample为false, 会将temperature设置为默认值, 来避免出现警告
感谢回复
您好,我在微调时设置了
--do_sample false
,但在微调后的模型配置文件 sft_args 中发现"temperature": 1.0
,这与命令行参数中描述的并不一致。其中 --predict_with_generate为默认设置False
同时在推理时若设置
--do_sample false
会提示:ValueError: [UserWarning('do_sample
is set toFalse
. However,temperature
is set to0.1
-- this flag is only used in sample-based generation modes. You should setdo_sample=True
or unsettemperature
.')