Skip to content

Conversation

gante
Copy link
Member

@gante gante commented Sep 4, 2025

What does this PR do?

(Carved from #40553, which is becoming messy)

Our tests have the model.config.get_text_config(decoder=True).is_encoder_decoder pattern, which doesn't make sense -- we're pulling the decoder if it exists, and then checking if it is encoder-decoder.

The pattern exists because of blip2, which wasn't setting is_encoder_decoder correctly -- if its LLM is an encoder-decoder model, then it is also an encoder-decoder model.

✅ blip 2 slow tests are passing

@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.

@gante
Copy link
Member Author

gante commented Sep 4, 2025

run-slow: blip_2

Copy link
Contributor

github-actions bot commented Sep 4, 2025

This comment contains run-slow, running the specified jobs:

models: ['models/blip_2']
quantizations: [] ...

@gante gante requested a review from zucchini-nlp September 4, 2025 17:00
"I will remove it now.\n\n"
"See https://github.com/pypa/pip/issues/5466 for details.\n"
).format(stale_egg_info)
f"Warning: {stale_egg_info} exists.\n\n"
Copy link
Member Author

Choose a reason for hiding this comment

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

make fixup corrected this 👀

pass

@parameterized.expand(TEST_EAGER_MATCHES_SDPA_INFERENCE_PARAMETERIZATION)
@unittest.skip("Won't fix: Blip2 + T5 backbone needs custom input preparation for this test")
Copy link
Member Author

Choose a reason for hiding this comment

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

can be fixed, but I don't think it's worth it 👀

Copy link
Member

Choose a reason for hiding this comment

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

agreed, let's assume that t5 passes the test so we are fine :)

@gante
Copy link
Member Author

gante commented Sep 4, 2025

run-slow: blip_2

Copy link
Contributor

github-actions bot commented Sep 4, 2025

This comment contains run-slow, running the specified jobs:

models: ['models/blip_2']
quantizations: [] ...

Copy link
Member

@zucchini-nlp zucchini-nlp left a comment

Choose a reason for hiding this comment

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

Thanks, it is much better to have it in model config level. Can you also verify how Florence2 works with this PR? Those are the only two VLMs with encoder-decoder backbone afaik

Comment on lines -403 to 404

if model.config.get_text_config(decoder=True).is_encoder_decoder:
if model.config.is_encoder_decoder:
self.assertTrue(output_generate.sequences.shape[1] == self.max_new_tokens + 1)
Copy link
Member

Choose a reason for hiding this comment

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

cool thanks, can you check if Florence2 model works with these changes? It is same as blip and uses Bart as backbone

pass

@parameterized.expand(TEST_EAGER_MATCHES_SDPA_INFERENCE_PARAMETERIZATION)
@unittest.skip("Won't fix: Blip2 + T5 backbone needs custom input preparation for this test")
Copy link
Member

Choose a reason for hiding this comment

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

agreed, let's assume that t5 passes the test so we are fine :)

[0, 3, 7, 152, 2515, 11389, 3523, 1],
"san francisco", # TODO: check if this is ok
),
("cuda", None): ([0, 3, 7, 152, 2515, 11389, 3523, 1], "san francisco"),
Copy link
Member

Choose a reason for hiding this comment

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

i believe the CUDA expectation incorrect from the beginning

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, I agree 👀

@gante
Copy link
Member Author

gante commented Sep 5, 2025

run-slow: florence2

Copy link
Contributor

github-actions bot commented Sep 5, 2025

This comment contains run-slow, running the specified jobs:

models: ['models/florence2']
quantizations: [] ...

Copy link
Member

@zucchini-nlp zucchini-nlp left a comment

Choose a reason for hiding this comment

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

Forgot to ✅

@gante
Copy link
Member Author

gante commented Sep 5, 2025

@zucchini-nlp florence2 slow tests were mostly green (there were 3 FA2 failures, which are unrelated to this PR) ✅

In florence2, is_encoder_decoder was correctly set for the start 👍

Copy link
Contributor

github-actions bot commented Sep 5, 2025

[For maintainers] Suggested jobs to run (before merge)

run-slow: blip_2

@gante gante merged commit a2a8a3c into huggingface:main Sep 5, 2025
23 checks passed
@gante gante deleted the blip_2_edge_case branch September 5, 2025 10:35
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