Repository navigation
fix: import torch before spmd_types to avoid circular import - #16
Open
bananighosh wants to merge 1 commit into
Open
bananighosh wants to merge 1 commit into
bananighosh wants to merge 1 commit into
Conversation
On the Neuron SDK 2.33 DLAMI, importing spmd_types before torch triggers the torch_neuronx backend autoload, which loads torch.distributed.fsdp; _fsdp_param_group.py then re-imports the partially initialized spmd_types and fails with "has no attribute 'register_local_autograd_function'". The Qwen3, DeepSeek-V3 and GPT-OSS recipes import spmd_types at module top, so their config_registry fails to import and ConfigManager reports "Config function ... not found" (e.g. the Qwen3-32B command in docs/dense-tutorials.md). Import torch in torchtitan_neuron/__init__.py so it is loaded before any recipe module. Tested on trn3-dev1.48xlarge, DLAMI ami-0dea3e9e3e3a16119 (torch 2.14.0, torch-neuronx 2.14.3.0.1, spmd_types 0.2.1): the four model config_registry modules import, and the dense-tutorials Qwen3-32B eager command runs 10/10 steps (rc=0).
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of changes:
On the Neuron SDK 2.33 DLAMI, importing spmd_types before torch triggers the torch_neuronx backend autoload, which loads torch.distributed.fsdp; _fsdp_param_group.py then re-imports the partially initialized spmd_types and fails with "has no attribute 'register_local_autograd_function'".
The Qwen3, DeepSeek-V3 and GPT-OSS recipes import spmd_types at module top, so their config_registry fails to import and ConfigManager reports "Config function ... not found" (e.g. the Qwen3-32B command in docs/dense-tutorials.md).
Import torch in torchtitan_neuron/init.py so it is loaded before any recipe module.
Tested on trn3-dev1.48xlarge, DLAMI ami-0dea3e9e3e3a16119 (torch 2.14.0, torch-neuronx 2.14.3.0.1, spmd_types 0.2.1): the four model config_registry modules import, and the dense-tutorials Qwen3-32B eager command runs 10/10 steps (rc=0).
error:
Issue #, if available: - N/A
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.