-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DeepSpeed ZeRO stage3+Qwen2/Qwen2-57B-A14B-Instruct: RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu) #32312
Comments
cc @muellerzr and @SunMarc ! |
Same issue encountered with LLaMA, ZeRO3, transformers==4.44.0, deepspeed==0.12.6, accelerate==0.33.0 |
I'll ping @muellerzr and @SunMarc internally on this, thanks for reporting |
Hi @ArthurZucker, (just fyi), I would like to try to help me with this ticket 🤗 |
This issue has been resolved after I rebased on top of the master branch, where it was addressed by a merge 14 hours ago 65bb284#diff-b1a8dc3bcd0052fd5b8db79800ba0f5049656730dd5788990cf41d36badc354e . Problem SummaryA device mismatch occurred in the ResolutionThere's also a small issue in your device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device) ReferenceHere is the environment I used to reproduce the error and diagnose the issue: https://github.com/irislin1006/deepSeedZero |
Thanks for the help @irislin1006 ! Really appreciate that ! Does it solves your issue @RobertXWL ? |
I also encountered a similar situation, but during backward, I used the Qwen2 model for LoRA fine-tuning. "zero_optimization": {
"stage": 3,
"offload_optimizer": {
"device": "cpu",
"pin_memory": true
},
"offload_param": {
"device": "cpu",
"pin_memory": true
},
"overlap_comm": true,
"contiguous_gradients": true,
"sub_group_size": 1e9,
"reduce_bucket_size": "auto",
"stage3_prefetch_bucket_size": "auto",
"stage3_param_persistence_threshold": "auto",
"stage3_max_live_parameters": 1e5,
"stage3_max_reuse_distance": 1e5,
"stage3_gather_16bit_weights_on_model_save": true
},
|
Hey @orrzohar @RobertXWL, Is the solution that @irislin1006 working for you? |
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
System Info
transformers==4.40.0
trl>=0.8.6
deepspeed==0.9.3
gpu: A100-SXM4-80GB*32
Who can help?
@ArthurZucker
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
dz_zero3.json
train.py
error message
bug
I found that there is a device mismatch in the apply_rotary_pos_emb function in modeling_qwen2_moe.py, where both cos and sin are on the CPU, but q, k, and position_ids are on CUDA.
It's quite strange. I'm not sure what the issue is, but when I made the following temporary modifications, it was able to run normally.:
Expected behavior
How can I resolve this device inconsistency issue? Is it due to my configuration?
The text was updated successfully, but these errors were encountered: