Skip to content

FIX use revision in ModelHubMixin.from_pretrained#1315

Merged
Wauplin merged 5 commits intomainfrom
1313-fix-pytorch-mixin-from-pretrained-revision
Feb 7, 2023
Merged

FIX use revision in ModelHubMixin.from_pretrained#1315
Wauplin merged 5 commits intomainfrom
1313-fix-pytorch-mixin-from-pretrained-revision

Conversation

@Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Jan 30, 2023

Fix #1313 cc @NielsRogge.

Some legacy code in ModelHubMixin was accepting revision as part of the model_id behind a "@" (e.g. model_id=namespace/repo_name@revision). It is the only place in hfh that supports this pattern so I think it's best to deprecate it in favor of a proper revision=... parameter. This PR does this.

Also I improved a bit the docstrings, function signatures (added typing + deprecated positional arguments) and the tests (use tmp directories everywhere instead of local fixtures dirs).

In parallel to this PR, I'll work on a guide to promote ModelHubMixin and PyTorchModelHubMixin. At the moment, we have them documented "only" in the package reference.

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jan 30, 2023

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

Copy link
Contributor

@osanseviero osanseviero left a comment

Choose a reason for hiding this comment

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

Very nice! 🔥

@Wauplin
Copy link
Contributor Author

Wauplin commented Feb 7, 2023

Thanks for taking the time to review @osanseviero :) I'm merging

@Wauplin Wauplin merged commit a4b1b33 into main Feb 7, 2023
@Wauplin Wauplin deleted the 1313-fix-pytorch-mixin-from-pretrained-revision branch February 7, 2023 11:17
tomaarsen added a commit to tomaarsen/setfit that referenced this pull request Nov 9, 2023
solved an issue that was causing failures
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.

TypeError: _from_pretrained() got multiple values for argument 'revision' when using PyTorchModelHubMixin

3 participants