Support NGRAM_EMBEDDING_CPU_OFFLOAD in non-FSDP (single-GPU and DDP) modes for qwen4_moe / qwen4_exp
I maintainer di solito rispondono entro 1 giorno
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Checklist / 检查清单
- I have searched existing issues, and this is a new feature request. / 我已经搜索过现有的 issues,确认这是一个新的 Feature Request。
Feature Request Description / Feature Request 描述
Currently, NGRAM_EMBEDDING_CPU_OFFLOAD (introduced in #10684) is only wired up when fsdp_version == 2 (swift/model/models/qwen.py and swift/pipelines/train/tuner.py).
However, for Qwen/Qwen4-35B-A3B (qwen4_moe), the total BF16 checkpoint is ~105.9 GiB, of which 38.15 GiB is the frozen Layer 2 ple.ple_embedding.ngram_embedding table and only 66.09 GiB are GPU-resident weights (60.00 GiB MoE experts + 5.26 GiB LM + 0.83 GiB visual).
Because NGRAM_EMBEDDING_CPU_OFFLOAD=1 is ignored in non-FSDP paths:
- Single-GPU (96 GiB / 141 GiB) and multi-GPU pure DDP LoRA runs default to
device_map='cuda:{local_rank}', which tries to place all 104.2 GiB onto one GPU and OOMs during model loading. - On multi-GPU PCIe machines without NVLink (where FSDP2
full_shardrepeatedly AllGathers 66 GiB of weights every micro-batch), users are forced into FSDP2 even though the 66.09 GiB base weights + LoRA fit directly on each 96 GiB GPU in pure DDP.
Supporting NGRAM_EMBEDDING_CPU_OFFLOAD=1 in non-FSDP (Qwen4ExpLoader.get_model + tuner.py) by building a mutually-exclusive device_map (keeping *.ple.ple_embedding.ngram_embedding on CPU and remaining weights on cuda:{local_rank}), stripping Accelerate hooks / hf_device_map, and wrapping the table with _HostEmbeddingProxy enables single-GPU 96 GiB LoRA and gives 3x+ speedup with pure DDP on PCIe multi-GPU hosts.
Pull Request / Pull Request 信息
A PR with unit tests and end-to-end 4x RTX PRO 6000 96 GiB verification is ready to be submitted right after this issue.
- Lingua principale
- Python
- Stelle
- 16.2k
- Fork
- 1.8k
- Merge medio
- 1g 14h
- PR unite (30g)
- 68
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di modelscope/ms-swift
-
get_multimodal_target_regex(..., exclude_router=True) does not exclude shared_expert_gateForse già presa @KonnyakuMatcha l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
modelscope/ms-swift#10696 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] GRPO REAL loss crashes with beta>0 and kl_in_reward=True (NoneType * Tensor)Forse già presa @newcloud123 l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
modelscope/ms-swift#10690 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] GRPO REAL loss divides by all groups instead of valid groups, silently scaling gradientsForse già presa @newcloud123 l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
modelscope/ms-swift#10688 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 Mezza giornata Idoneità per principianti 62/100
modelscope/ms-swift#10621 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] `get_seed` consumes a draw from the shared RandomState even when decision augmentation is disabled, changing the train/val split and dataset shuffleForse già presa @ryznren l’ha presa 38 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
modelscope/ms-swift#10466 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di modelscope/ms-swift
Issue simili
-
Test: to_hijri() accepts datetime.datetime and uses only the date partForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertagood first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
omarelshamy25x/shamy-hijri#63 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
polish
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
521xueweihan/HelloGitHub#4729 ·
-
[Bug]: Score parser reads parts of scientific notation as valid scoresForse già presa @AshutoshSingh840 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
UKGovernmentBEIS/control-arena#992 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
mvalentsev/awesome-free-ai-coding#70 ·
I maintainer di solito rispondono entro 1 giorno