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

Fix initialization of mutable types #15365

Closed
wants to merge 1 commit into from

Conversation

NielsRogge
Copy link
Contributor

What does this PR do?

This PR fixes the initialization of mutable types for Swin Transformer, SegFormer and BEiT (as pointed out by @FrancescoSaverioZuppichini in #15277).

It also fixes a small docs issue for Swin Transformer.

@HuggingFaceDocBuilder
Copy link

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

@sgugger
Copy link
Collaborator

sgugger commented Jan 27, 2022

This is present in many more configurations, so if we decide to switch it should be for all of them and not only for three configs.

Having a default for a mutable parameter is dangerous when the function mutates the parameter, which is not the case for our config inits, it's merely stored. I don't think we need to switch to None, which would result in the signatures in the doc being less complete.

@LysandreJik
Copy link
Member

I'm also not convinced it's super important as these are lookup values, but if you feel strongly a simpler way of doing this is to switch everything tu tuples, which are immutable. It keeps the arguments in the docstrings as well and can be converted to lists quite easily.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@github-actions github-actions bot closed this Mar 6, 2022
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.

None yet

4 participants