Skip to content

Add bounds check for AuraFlow positional embedding indices#13110

Open
Mr-Neutr0n wants to merge 1 commit intohuggingface:mainfrom
Mr-Neutr0n:fix-auraflow-pe-bounds
Open

Add bounds check for AuraFlow positional embedding indices#13110
Mr-Neutr0n wants to merge 1 commit intohuggingface:mainfrom
Mr-Neutr0n:fix-auraflow-pe-bounds

Conversation

@Mr-Neutr0n
Copy link

Summary

  • Add a bounds check in AuraFlowPatchEmbed.pe_selection_index_based_on_dim() to prevent out-of-bounds positional embedding indices
  • When the input latent dimensions exceed the PE grid size, the centered-crop index calculation produces negative or out-of-range indices, causing a fatal CUDA assertion error (ind >= 0 && ind < ind_dim_size) that destroys the CUDA context for the entire process
  • Raise a clear ValueError with guidance on how to fix the issue, instead of silently producing invalid indices

Fixes #12656

Test plan

  • Verify that inputs within the PE grid size work as before
  • Verify that inputs exceeding the PE grid raise a clear ValueError

When the input latent spatial dimensions exceed the positional
embedding grid size, the centered-crop index calculation produces
negative or out-of-range indices. This causes a fatal CUDA assertion
error that destroys the CUDA context for the entire process.

Add an explicit check that raises a clear ValueError instead of
silently producing invalid indices.
@Mr-Neutr0n
Copy link
Author

Friendly bump! Let me know if there's anything I should update or improve to help move this forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Positional Embedding Index Out-of-Bounds in AuraFlow

1 participant