modelscope / modelscope/ms-swift

Qwen3-VL emb微调,训练到一半CPU OOM

Open
#8,372 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Checklist / 检查清单
  • I have searched existing issues, and this is a new bug report. / 我已经搜索过现有的 issues,确认这是一个新的 bug report。
Bug Description / Bug 描述
Image Image
  • 32卡分布式训练,使用ZERO2。

  • 训练log的最后一行loss日志:{'loss': 1.89589844, 'grad_norm': 0.04135821, 'learning_rate': 4.134e-05, 'epoch': 0.31, 'global_step/max_steps': '60/193', 'percentage': '31.09%', 'elapsed_time': '3h 36m 48s', 'remaining_time': '8h 0m 35s', 'memory(GiB)': 20.61, 'train_speed(iter/s)': 0.004612}

Rank(Worker): 16 caught unknown unhandled exception:
Exception type: OOM
Detail:
return code is -9, maybe OUT OF MEMORY, please check kmon

How to Reproduce / 如何复现

swift_version:4.0.0.dev0
"model": "Qwen/Qwen3-VL-Embedding-8B",
"dataset": 视频训练数据.json,
"task_type": "embedding",
"tuner_type": "lora",
"lora_rank": 8,
"lora_alpha": 32,
"target_modules": "all-linear",
"learning_rate": "5e-5",
"attn_impl": "flash_attn",
"max_length": 4096,
"load_from_cache_file": true,
"num_train_epochs": 1,
"per_device_train_batch_size": 16,
"per_device_eval_batch_size": 2,
"gradient_accumulation_steps": 2,
"dataloader_num_workers": 0,
"dataset_num_proc": 1,
"warmup_ratio": 0.05,
"loss_type": "infonce",
"infonce_temperature": 0.02,
"deepspeed": "zero2",
"padding_free": true,
"torch_dtype": "bfloat16",
"save_steps": 20,
"eval_steps": 500,
"save_total_limit": 2,
"logging_steps": 20,
"model_kwargs": {"fps_max_frames":6, "image_max_token_num":60, "video_max_token_num":60,"video_min_token_num":8}

Additional Information / 补充信息

No response

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 by reproducing the reported 32-card distributed Qwen3-VL embedding run with the supplied ZERO2, batch, video, and LoRA settings. Inspect the final training log, Rank 16 worker failure, and kmon output to determine what causes the CPU OOM. Done means the cause is identified and the same configuration can progress without the reported worker termination.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
distributed-systems, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.