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

[BC] Introduce decorator hack to preserve BC with incorrect usage of save_to_hub #2380

Merged
merged 1 commit into from
Dec 14, 2023

Conversation

tomaarsen
Copy link
Collaborator

Related to #2376

Hello!

Pull Request overview

  • Introduce decorator hack to preserve BC with incorrect usage of save_to_hub

Details

By incorrect usage I am referring to providing keyword arguments using positional arguments & vice versa. Through this new decorator, you can once again do:

url = model.save_to_hub(repo_name="sentence-transformers-testing/stsb-bert-tiny-safetensors")

and

url = model.save_to_hub(
    "stsb-bert-tiny-safetensors", # repo_name
    "sentence-transformers-testing", # organization
    True, # private
    "Adding new awesome Model!", # commit message
    exist_ok=True,
)

I've added tests to ensure that the behaviour is indeed the same as before.

Note

This decorator hack can only be applied once, if another keyword argument is also introduced in a future version, then we can't allow positional arguments to be used with keyword arguments anymore.

cc: @osanseviero

  • Tom Aarsen

…to_hub

E.g. providing keyword arguments using positional arguments & vice versa.
@tomaarsen tomaarsen merged commit 9a2e415 into UKPLab:master Dec 14, 2023
8 checks passed
@tomaarsen tomaarsen deleted the bc/save_to_hub branch December 14, 2023 15:26
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.

1 participant