Skip to content
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

FX symbolic_trace: do not test decoder_inputs_embeds #31840

Merged
merged 1 commit into from
Jul 9, 2024

Conversation

fxmarty
Copy link
Contributor

@fxmarty fxmarty commented Jul 8, 2024

As per title, fixes #31574 (comment)

#31574 was meant to support inputs_embeds, not decoder_inputs_embeds. As some encoder-decoder models, we hit some errors (ValueError: You have to specify either decoder_input_ids or decoder_inputs_embeds).

@fxmarty fxmarty requested review from amyeroberts and ydshieh July 8, 2024 13:48
Copy link
Collaborator

@amyeroberts amyeroberts left a comment

Choose a reason for hiding this comment

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

Thanks for fixing!

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@ydshieh
Copy link
Collaborator

ydshieh commented Jul 8, 2024

Isn't the error happening for input_embed?

/usr/local/lib/python3.10/site-packages/transformers/models/blenderbot_small/modeling_blenderbot_small.py:711: in forward
raise ValueError("You have to specify either input_ids or inputs_embeds")
E ValueError: You have to specify either input_ids or inputs_embeds

(here is BlenderbotSmallEncoder).

@fxmarty
Copy link
Contributor Author

fxmarty commented Jul 8, 2024

@ydshieh yes, that's because inputs_embeds was not in the input_names list here

if model.config.is_encoder_decoder:
model.config.use_cache = False # FSTM still requires this hack -> FSTM should probably be refactored similar to BART afterward
labels = inputs.get("labels", None)
input_names = [
"attention_mask",
"decoder_attention_mask",
"decoder_input_ids",
"input_features",
"input_ids",
"input_values",
]
for encoder-decoder models, and is then filtered out
filtered_inputs = {k: v for (k, v) in inps.items() if k in input_names}
.

Copy link
Collaborator

@ydshieh ydshieh left a comment

Choose a reason for hiding this comment

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

Thanks!

@ydshieh ydshieh merged commit 0abf5e8 into huggingface:main Jul 9, 2024
19 checks passed
@amyeroberts
Copy link
Collaborator

@fxmarty There's still errors with fx tests happening on main: https://app.circleci.com/pipelines/github/huggingface/transformers/97262/workflows/8822144c-e8ed-4722-a982-72ee876c3eda/jobs/1287254

FAILED tests/models/mobilebert/test_modeling_mobilebert.py::MobileBertModelTest::test_torch_fx - RuntimeError: mat1 and mat2 shapes cannot be multiplied (4x192 and 96x64)
FAILED tests/models/mobilebert/test_modeling_mobilebert.py::MobileBertModelTest::test_torch_fx_output_loss - RuntimeError: mat1 and mat2 shapes cannot be multiplied (4x192 and 96x64)

Could you take a look?

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.

4 participants