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

Allow example to use a revision and work with private models #9407

Merged
merged 3 commits into from
Jan 6, 2021

Conversation

sgugger
Copy link
Collaborator

@sgugger sgugger commented Jan 4, 2021

What does this PR do?

This PR adds the ability to:

  • pick a particular revision for a model checkpoint
  • use private models when the user is logged in
    with the example scripts.

Just did run_glue as a proof of concept, will duplicate to all examples and the new example template if this suits everyone.

@julien-c
Copy link
Member

julien-c commented Jan 5, 2021

+1 on the model_revision part

On the use_auth_token, I was thinking we could try to implement auto-use of the token iff the model is not public (i.e. send the token for non-existent models and private models, as the server doesn't make a difference for those two cases when unauthorized – you get a 404 in both cases – said differently if you don't have access to a model you shouldn't know whether it's an existing private model)

This will require some implementation changes in file_utils though so it might take a bit of time.

If you think it's helpful to expose this PR's manual option first, I'm ok with that.

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

LGTM as is, no opinion regarding the use_auth_token.

Regarding your comment @julien, since fetching a private model with no auth token returns a 404, we should complete the incorrect model identifier error to say that the user may have forgotten its auth token:

OSError: Can't load config for 'lysandre/private'. Make sure that:

- 'lysandre/private' is a correct model identifier listed on 'https://huggingface.co/models'

- or 'lysandre/private' is the correct path to a directory containing a config.json file

If 'lysandre/private' is a private model, make sure your authentication token is correctly setup.

wdyt?

@julien-c
Copy link
Member

julien-c commented Jan 5, 2021

@LysandreJik Yep totally right! I won't personally get around to adding the feature in file_utils/huggingface_hub in the next 2-3 weeks though, so maybe worth it to merge it like this in the meantime:)

@sgugger
Copy link
Collaborator Author

sgugger commented Jan 5, 2021

I think it's important to provide the option right now to let the user play with their private models for those scripts. We can have that flag become None later on and default to the right thing when the implementation in file_utils permits it then remove it entirely a bit later.

@julien-c
Copy link
Member

julien-c commented Jan 5, 2021

sounds good

@LysandreJik
Copy link
Member

Sounds good!

@LysandreJik LysandreJik merged commit 453a70d into master Jan 6, 2021
@LysandreJik LysandreJik deleted the examples_model_versioning branch January 6, 2021 11:49
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.

3 participants