Skip to content

Fix missing raise before NotImplementedError in Flux SPMD example#13544

Open
Ricardo-M-L wants to merge 1 commit intohuggingface:mainfrom
Ricardo-M-L:fix-flux-spmd-missing-raise
Open

Fix missing raise before NotImplementedError in Flux SPMD example#13544
Ricardo-M-L wants to merge 1 commit intohuggingface:mainfrom
Ricardo-M-L:fix-flux-spmd-missing-raise

Conversation

@Ricardo-M-L
Copy link
Copy Markdown
Contributor

What does this PR do?

In examples/research_projects/pytorch_xla/inference/flux/flux_inference_spmd.py, the NotImplementedError exception object is created but never raised when num_devices < 4:

# Before (bug):
else:
    NotImplementedError  # creates object, doesn't raise it

# After (fix):
else:
    raise NotImplementedError(f"SPMD mesh requires at least 4 devices, got {num_devices}")

Without raise, execution continues to the next line where mesh is undefined, causing a confusing NameError instead of the intended informative error.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline?

Who can review?

@yiyixuxu @sayakpaul

The exception object was created but never raised, so execution would
continue and crash with NameError on the next line when mesh is
undefined. Add raise keyword and a descriptive error message.
@github-actions github-actions Bot added examples size/S PR with diff < 50 LOC labels Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

examples size/S PR with diff < 50 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant