Skip to content

Use config.num_channels in CLIP-like modeling files#20857

Merged
ydshieh merged 1 commit into
mainfrom
cleanup_config_attrs_6
Dec 21, 2022
Merged

Use config.num_channels in CLIP-like modeling files#20857
ydshieh merged 1 commit into
mainfrom
cleanup_config_attrs_6

Conversation

@ydshieh

@ydshieh ydshieh commented Dec 21, 2022

Copy link
Copy Markdown
Collaborator

What does this PR do?

config.num_channels is not used in some CLIP-like modeling files. Unlike previous PRs like #20596 or #20844, we use this attribute in the modeling files in this PR.

The only breaking case is when a user previously set config.num_channels=X with X !=3, which is super unlikely IMO. (Even they did so, the actual Conv2D layer still uses 3 as it is hard-coded in the current main branch)

@ydshieh
ydshieh requested a review from NielsRogge December 21, 2022 08:13
@HuggingFaceDocBuilderDev

HuggingFaceDocBuilderDev commented Dec 21, 2022

Copy link
Copy Markdown

The documentation is not available anymore as the PR was closed or merged.

@NielsRogge NielsRogge left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@ydshieh
ydshieh requested a review from LysandreJik December 21, 2022 09:39

@LysandreJik LysandreJik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sounds good to me, I checked on the Hub and couldn't find any model that uses config.num_channels != 3.

@ydshieh
ydshieh merged commit 852e7eb into main Dec 21, 2022
@ydshieh
ydshieh deleted the cleanup_config_attrs_6 branch December 21, 2022 10:51
MKhalusova pushed a commit to MKhalusova/transformers that referenced this pull request Dec 28, 2022
)

Use config.num_channels in CLIP-like modeling files

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
silverriver pushed a commit to silverriver/transformers that referenced this pull request Jan 6, 2023
)

Use config.num_channels in CLIP-like modeling files

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
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