-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Proposal of utility function + command to push models to HF Hub #5370
Conversation
The test failure in "GPU Tests" is due to OOM, unrelated to your changes. #5371 is a temporary fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will do the right thing both when the repo already exists, and when it's a new repo, right?
Sorry, forgot to answer this. Yes, it will create a new repo if it does not exist. If it does exist, one bad thing of running the script multiple times is that we don't override the model card to prevent deleting work. We have an issue that should make this easier to do in a future iteration. |
Hi @dirkgr, do you have any suggestions on how to do the testing of pushing to the Hub? I have few alternatives: 1. We have a staging backend and we could provide an account in which the test can push the models (example) Pros:
Cons
2. Mock the responses from the server (no-network test) Pros:
Cons:
3. Any other ideas that you might have :D |
We already rely on HF servers (and others) in the tests. I don't know if this is an exhaustive list, but I'm pretty sure we need at least S3, GCS, Huggingface, pypi, and GitHub to be up and running. There maybe be others. Wandb maybe? I think testing against a HF staging server is acceptable, unless we find that the staging server is down all the time when you're testing other things on it. |
Thanks a lot for your input! I've added a test suite for the |
Since I am on 👶🏻 leave, I am leaving this in @epwalsh's capable hands. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! Thanks for you work @osanseviero!
I noticed the new tests are failing due to an authentication error. I'm guessing we need to add a token as a secret to GitHub Actions?
Co-authored-by: Pete <[email protected]>
Congrats @dirkgr!!! Those are exciting news! @epwalsh, when the environment variable Given that I cannot run the workflow manually, I would appreciate if you could give a hand on checking where is the right place for setting the environment variable for the test. |
@osanseviero ah I see. It does look like it was put in the wrong place. If you put that environment variable up here it should work. |
Thanks for the pointer! |
I missed there were other tests using HF models in @LysandreJik do you think we could create a similar repo in staging so we can entirely rely on that environment? |
@osanseviero, what if we just set that environment variable from within the Python tests? That way we only have to set it for tests that require it. |
@LysandreJik please correct me if I'm wrong, but the reason behind using an environment variable vs setting the variable in the Python test is because this happens at import time. I think one solution would be to move |
In the
Indeed, we define the URL to the endpoint as a global variable; with an environment variable we can control that variable without any issues. |
Sorry for the delay. I think tests should pass now in GA. Since only the Let me know if other changes are required |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much @osanseviero! Looks great!
This PR allows users to push their repos to the Hugging Face Hub as a continuation of #5052. This is done with a
push_to_hf
utility function which is also added as a command.Use case 1: Pushing from a
serializable-directory
to the HubExample output: https://huggingface.co/osanseviero/test_allennlp
Use case 2: Pushing from an archive (
.tar.gz
) file to the HubThis is specially useful for the AI2 team to upload their existing models
Example output: https://huggingface.co/osanseviero/bidaf-model-2020.03.19
Few things to notice:
Users can search for all
AllenNLP
models in https://huggingface.co/models?filter=allennlpUsers get working widget to try out the model in the browser (currently some changes ongoing in Upgrade AllenNLP + hotfix huggingface/huggingface_hub#287)
If you are satisfied with the high-level approach + code location, I'll proceed to implement the test suite for this.
I wanted to keep this PR relatively small, but as a follow-up, we can do improvements so the automated model card contains useful information. Additionally, we can add the metrics from
metrics.json
.