modelscope / modelscope/ms-swift

DPO Qwen2.5 Omni, inputs_embeds = base_model.thinker.model.embed_tokens(input_ids),RuntimeError: 'weight' must be 2-D

Open
#6,373 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale
Dominant language
Python
Stars
15.7k
Forks
1.7k
Avg merge
1d 16h
Merged PRs (30d)
136

Description

Describe the bug
DPO微调Qwen2.5 Omni-7B,设置流式读取

Your hardware and system info
训练脚本如下:

NPROC_PER_NODE=8 \
MAX_PIXELS=602112 \
VIDEO_MAX_PIXELS=602112 \
FPS_MAX_FRAMES=64 \
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 \


swift rlhf \
    --rlhf_type dpo \
    --model ./models/Qwen2.5-Omni-7B \
    --train_type full \
    --dataset xxx/dpo-v1-swift.json \
    --load_from_cache_file true \
    --split_dataset_ratio 0.01 \
    --torch_dtype bfloat16 \
    --num_train_epochs 1 \
    --per_device_train_batch_size 1 \
    --per_device_eval_batch_size 1 \
    --learning_rate 1e-5 \
    --gradient_accumulation_steps 2 \
    --eval_steps 100 \
    --save_steps 100 \
    --save_total_limit 2 \
    --logging_steps 5 \
    --max_length 32000 \
    --output_dir output/qwen2_5_dpo \
    --warmup_ratio 0.05 \
    --save_only_model true \
    --dataloader_num_workers 4 \
    --dataset_num_proc 4 \
    --deepspeed zero3 \
    --attn_impl flash_attn \
    --rpo_alpha 0.1 \
    --padding_free true \
    --lora_rank 64 \
    --lora_alpha 32 \
    --freeze_vit true \
    --streaming true \
    --max_steps 1368

debug发现llm/template/template的qwen.py中780行
inputs_embeds = base_model.thinker.model.embed_tokens(input_ids)
中的base_model.thinker.model.embed_tokens.shape[0]
Additional context
Add any other context about the problem here(在这里补充其他信息)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with llm/template/template/qwen.py around line 780 and trace how the DPO streaming path constructs base_model.thinker.model.embed_tokens. Reproduce the reported command with the listed Qwen2.5-Omni configuration, then inspect why the embedding weight has shape [0]. Done means identifying and correcting the failing path with a regression check for this training setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.