You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found that after running simple_example.py, nvidia-smi still showed that I had processes consuming memory. I suspected that the created processes were not being cleared, so I added code to clean up the processes, which solved the problem.
i also find when i set the n_stage>1, there are some device error.
I fixed the device transfer logic in modeling_qwen3.py. Key improvements include: Dynamically obtaining device location: Instead of hardcoding torch.device(0) or torch.device(i+1), the target device is determined by querying the device location of the actual model parameters.
Device transfer after embedding: After performing embedding, hidden_states is immediately transferred to the device of the first layer to avoid device mismatch.
Inter-layer device transfer: When transferring between different device groups, the actual device location of the next layer is queried instead of assuming a device index.
Appreciate it!
It is better to apply your second PR to the scaffold.py file, as most of our modeling codes are auto-generated by scaffold.py instead of copy-and-revise.
Thanks for pointing that out! The device error happens because tie_word_embeddings is set to true in some Qwen3 config.json files. When this option is enabled, the embed_tokens and lm_head layers share the same weights.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I found that after running simple_example.py, nvidia-smi still showed that I had processes consuming memory. I suspected that the created processes were not being cleared, so I added code to clean up the processes, which solved the problem.