-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add push to Hub functionalities #2897
Conversation
cc @Wauplin and @LysandreJik 🤗 |
@osanseviero looks good, though when I run this code: from flair.models import SequenceTagger
model: SequenceTagger = SequenceTagger.load('ner-fast')
model.push_to_hub(repo_id='flair/test-push', private=True) it fails with
The first part of the error message is a bit hard to parse. How can I provide a token? |
Could be related to #2919 - it would be good to have a consistent way of passing tokens. |
Ah good point about the error message! I was assuming user is already logged in through What we can do is add a The token for loading will be a bit more complex as this would require changing the loading function |
Yes, a |
Done! Here is a repo I created by passing the token. |
Looks like mypy is throwing some odd errors again, somehow checking code in some cache directory:
@helpmefindaname do you have an idea what is going on here? |
Hey there :) it seems things were fixed, should we merge this PR? |
Hello @osanseviero sorry for the delay in checking this. I've created a token and pushed a small model, experimenting with both a public and private repo: For public I used: model: SequenceTagger = SequenceTagger.load('ner-fast')
model.push_to_hub(repo_id='alanakbik/test-push-public', private=False, token="[ .. my token ..]") For private I used: model: SequenceTagger = SequenceTagger.load('ner-fast')
model.push_to_hub(repo_id='alanakbik/test-push-private', private=True, token="[ .. my token ..]") The public one works, the private one doesn't. I am getting this error: Repository Not Found for url: https://huggingface.co/api/models/alanakbik/test-push-private.
Please make sure you specified the correct `repo_id` and `repo_type`.
If the repo is private, make sure you are authenticated. In spite of the error, a private repo is created at https://huggingface.co/alanakbik/test-push-private, but it is empty. Any ideas what I am doing wrong? |
Co-authored-by: Lucain <lucainp@gmail.com>
@osanseviero thanks for adding this and @Wauplin thanks for finding the fix for private repos! |
This is a follow-up of #2280
Flair users would benefit by being able to easily share their models and try them out with the Hub widgets or load models from others. Here is an example repo created out of it
This also implements a basic automatic model card generation with the appropriate tags for Flair models to be discoverable. This uses a non-git method so users are not required to use git-locally, even if in the remote server we do have git-versioning.
Let us know what you think! cc @stefan-it