Skip to content

Modernize CLIP modeling code #41546

Merged
molbap merged 12 commits intomainfrom
clip_improve
Oct 21, 2025
Merged

Modernize CLIP modeling code #41546
molbap merged 12 commits intomainfrom
clip_improve

Conversation

@molbap
Copy link
Copy Markdown
Contributor

@molbap molbap commented Oct 13, 2025

What does this PR do?

As per title. Adds the nice recent modeling utils to CLIP. Was motivated to be able to use it in the looong-standing #33962 .

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

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.

@molbap
Copy link
Copy Markdown
Contributor Author

molbap commented Oct 20, 2025

cc @zucchini-nlp if you want to take a look!

Copy link
Copy Markdown
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.

Amazing, happy to see the models being standardized 🚀 Let's run slow tests with CLIP and LLaVA-CLIP before merging, just to be sure :)

@molbap
Copy link
Copy Markdown
Contributor Author

molbap commented Oct 20, 2025

run-slow: clip, metaclip_2

@github-actions
Copy link
Copy Markdown
Contributor

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

models: ['models/clip', 'models/metaclip_2']
quantizations: [] ...

@molbap
Copy link
Copy Markdown
Contributor Author

molbap commented Oct 21, 2025

run-slow: clip, metaclip_2

@github-actions
Copy link
Copy Markdown
Contributor

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

run-slow: clip, metaclip_2

@github-actions
Copy link
Copy Markdown
Contributor

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

models: ['models/clip', 'models/metaclip_2']
quantizations: [] ...

Copy link
Copy Markdown
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

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

Nine ty

@molbap molbap merged commit 1d651c7 into main Oct 21, 2025
20 checks passed
@molbap molbap deleted the clip_improve branch October 21, 2025 14:04
ngazagna-qc pushed a commit to ngazagna-qc/transformers that referenced this pull request Oct 23, 2025
* stranded

* update modular

* modularities

* update

* fx broken

* fx stillb roken

* update

* missed this

* fix metaclip
i3hz pushed a commit to i3hz/transformers that referenced this pull request Oct 30, 2025
* stranded

* update modular

* modularities

* update

* fx broken

* fx stillb roken

* update

* missed this

* fix metaclip
SangbumChoi pushed a commit to SangbumChoi/transformers that referenced this pull request Jan 23, 2026
* stranded

* update modular

* modularities

* update

* fx broken

* fx stillb roken

* update

* missed this

* fix metaclip
@yukiu00
Copy link
Copy Markdown

yukiu00 commented Feb 5, 2026

Hi there,

We recently encountered an issue with transformers v5.0.0rc1 that seems to be related to the changes in this PR.

Specifically, CLIPVisionModel.forward() now returns hidden_states=None even when output_hidden_states=True is passed. It appears that the output_hidden_states argument was removed from ClipEncoder.forward (or is not being utilized from TransformersKwargs correctly).

Comparison:

We suspect this is a regression. Could you please check if this was intended?

Related

@ArthurZucker
Copy link
Copy Markdown
Collaborator

Thanks for the report, having a look and yes it should work with check_model_inputs

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.

5 participants