Skip to content

channel loss 训练报错 #4874

Open
Open
@dhhcj

Description

@dhhcj

Describe the bug
What the bug is, and how to reproduce, better with screenshots(描述bug以及复现过程,最好有截图)

File "/data/aobozhang/miniconda3/envs/llama-factory/lib/python3.10/site-packages/swift/trainers/mixin.py", line 419, in train
res = super().train(*args, **kwargs)
File "/data/aobozhang/miniconda3/envs/llama-factory/lib/python3.10/site-packages/transformers/trainer.py", line 2245, in train
return inner_training_loop(
File "/data/aobozhang/miniconda3/envs/llama-factory/lib/python3.10/site-packages/transformers/trainer.py", line 2560, in _inner_training_loop
tr_loss_step = self.training_step(model, inputs, num_items_in_batch)
File "/data/aobozhang/miniconda3/envs/llama-factory/lib/python3.10/site-packages/swift/trainers/trainers.py", line 346, in training_step
return super().training_step(model, inputs, *args, **kwargs)
File "/data/aobozhang/miniconda3/envs/llama-factory/lib/python3.10/site-packages/transformers/trainer.py", line 3736, in training_step
loss = self.compute_loss(model, inputs, num_items_in_batch=num_items_in_batch)
File "/data/aobozhang/miniconda3/envs/llama-factory/lib/python3.10/site-packages/swift/trainers/trainers.py", line 326, in compute_loss
loss = compute_loss_func(outputs, labels, num_items_in_batch=num_items_in_batch, **loss_kwargs)
File "/data/aobozhang/miniconda3/envs/llama-factory/lib/python3.10/site-packages/swift/plugin/loss.py", line 520, in channel_loss_func
channels = trainer.args.channels
AttributeError: 'NoneType' object has no attribute 'args'

报错信息

CUDA_VISIBLE_DEVICES=1 swift sft --model_type qwen3 --train_type lora --lora_rank 96 --model /data/changjianhou/Qwen3-8B --dataset /data/changjianhou/DATA/got/ppt_online/all_sft_0623_non_cot_all.json --split_dataset_ratio 0.1 --output_dir /data/changjianhou/DATA/model_output/ppt_model_3——8B/lora_96_v7 --per_device_train_batch_size 1 --num_train_epochs 4 --max_length 23000 --per_device_eval_batch_size 1 --eval_step 1000 --gradient_accumulation_steps 6 --loss_type channel_loss --channels 'think' 'structure7' 'structure6' 'structure5' 'think' 'flow' 'ppt_q1' 'ppt_q2' 'comments'

训练命令

数据集也根据指定的方式进行重置

Your hardware and system info
Write your system info like CUDA version/system/GPU/torch version here(在这里给出硬件信息和系统信息,如CUDA版本,系统,GPU型号和torch版本等)

Additional context
Add any other context about the problem here(在这里补充其他信息)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions