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

Autoupload models to huggingface hub after training #2416

Closed
6 tasks
tstadel opened this issue Apr 13, 2022 · 4 comments · Fixed by #2618
Closed
6 tasks

Autoupload models to huggingface hub after training #2416

tstadel opened this issue Apr 13, 2022 · 4 comments · Fixed by #2618

Comments

@tstadel
Copy link
Member

tstadel commented Apr 13, 2022

Is your feature request related to a problem? Please describe.
When training with FARMReader finishes, there should be an option to upload it automatically to HF hub.

Describe the solution you'd like
Add option and template to auto upload trained / fine-tuned model to HF.

Describe alternatives you've considered
Implement helper function to upload model to HF manually. Maybe we go for that if the selection of the model snapshot involves human interaction.

Tasks:

  • add hf_token, hf_repo, hf_branch, hf_model_card params to FARMReader.train(), DensePassageRetriever.train() and TableTextRetriever.train()
  • create repo if not exists
  • convert model into huggingface format
  • upload model files and model card
  • provide model card template
  • write documentation about how to use it
@tstadel
Copy link
Member Author

tstadel commented Apr 28, 2022

Using huggingface_hub lib we can create a repo and upload them model files. To add a model card, we simply have to upload a README.md according to this structure.
Additionally we might want to enable users to specify a version of the model. This could be achieved by using branches in the model repo.

@tstadel
Copy link
Member Author

tstadel commented May 25, 2022

Sentencetranformers lib also offers this kind of functionality. Maybe we can get some inspiration from there, too.

@TuanaCelik
Copy link
Member

Additionally, it might make sense to make this available for distilled models too. Something that would allow you to do:

student.distil_intermediate_layers_from(teacher, data_dir=".", train_filename="augmented_dataset.json", use_gpu=True)
student.distil_prediction_layer_from(teacher, data_dir="data/squad20", train_filename="dev-v2.0.json", use_gpu=True)
student.push_to_hf()

In this case, a helper function might make more sense though as there won't be a .train() to provide the HF options to.

@TuanaCelik
Copy link
Member

I got a first draft of this to work with FarmReader. The model gets converted to the transformers model format so it can be reused later by loading it back from HF too. Created a draft PR 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants