Skip to content

Add test to ensure executorch exportability with dynamic shapes#43424

Open
justinchuby wants to merge 1 commit intohuggingface:mainfrom
justinchuby:justinchu/exporter-test
Open

Add test to ensure executorch exportability with dynamic shapes#43424
justinchuby wants to merge 1 commit intohuggingface:mainfrom
justinchuby:justinchu/exporter-test

Conversation

@justinchuby
Copy link
Copy Markdown
Contributor

@justinchuby justinchuby commented Jan 22, 2026

What does this PR do?

Previously the models were not exportable with dynamic shapes due to slices removed in #41900.

This PR adds a test to ensure executorch exportability with dynamic shapes.

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,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

@vasqu @ArthurZucker @Cyrilvallez

Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Comment thread tests/test_executorch.py
)
torch.testing.assert_close(eager_output_embeds, exported_output_embeds, atol=1e-4, rtol=1e-4)

def test_decoder_only_lm_export_with_dynamic_shapes(self):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I re-added the slice ops and it still passed (torch 2.9.0) so we should make it a bit more constrained

I assume this is due to a simple forward not really changing shapes, hence the slicing doesn't matter? Or given that there is not attention mask, it isn't really triggered?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Yes an attention mask is probably needed

@justinchuby
Copy link
Copy Markdown
Contributor Author

@vasqu even though this test does not include masks, it is still useful to guard general exportability with dynamic shapes. Would it be possible to merge this change first? I can create a follow up with more test variations.

@vasqu
Copy link
Copy Markdown
Contributor

vasqu commented Feb 19, 2026

@justinchuby Not opposed to it in general but I don't really see the merit in having a test that doesn't cover its original purpose? Would it be possible to extend these tests here instead?

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.

2 participants