Skip to content

Add ConstantArgument support to fx_import #4244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 1, 2025

Conversation

alaa-ali
Copy link
Contributor

@alaa-ali alaa-ali commented Jun 27, 2025

This PR will fix the following issue:
fx_importer NotImplementedError: MultiheadAttention layer with NeedWeight = false

The following error was raised before this fix:
Python Error: NotImplementedError: OutputKind.USER_OUTPUT for <class
'torch.export.graph_signature.ConstantArgument'>: ConstantArgument(name='',
value=None)

This occurs for an exported MultiheadAttention layer with "NeedWeight = false" which means weights are not going to be returned by the layer. So, the second output attn_output_weights will be None in this case.

@penguin-wwy
Copy link
Collaborator

@stellaraccident plz review this

Copy link
Collaborator

@stellaraccident stellaraccident left a comment

Choose a reason for hiding this comment

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

Thank you for the comprehensive tests.

@stellaraccident
Copy link
Collaborator

Looks like test are failing. Let's talk about this if it is due to a too old version of pt in the CI.

@penguin-wwy penguin-wwy merged commit 4f3a60b into llvm:main Jul 1, 2025
3 checks passed
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.

3 participants