tensorflow/tfx-addons

Integration with HuggingFace Hub

deep-diver opened this issue ยท 5 comments

Hi folks (cc: @rcrowe-google , @sayakpaul)

as you know, HuggingFace provides Hub to host models and prototype applications. I think this is a nice place for some reasons:

  1. If the model is compatible to ๐Ÿค— Transformer, the model can be easily loaded up and used with the library. In these days, lots of ML practitioners are familiar with the usage of Transformers.

  2. HuggingFace Hub comes with Git-LFS feature out of the box, so it is a good place to store the large size of model files with version controls in Git manner.

  3. HuggingFace Space let us write simple applications with Gradio and Streamlit, and it provides a VM to serve the applications. The VM spec is not great, but it can be improved over time. Also, before the actual production releases of the model, we can let people to play with the experimental versions of the model, and get some feedback.

To this end, I want to propose two components:

  • HFModelPusher : It pushes a model from an upstream TFX component such as Trainer to the HuggingFace Model Hub

  • HFSpacePusher : It pushes an application codes to the HuggingFace Space Hub. This is intended to work as the downstream step of the HFModelPusher. Some placeholders in the application template codes will be replaced with the outputs of the HFModelPusher such as model_repo_id, model_version

Below image shows how they are interconnected

tmp

#174 for the first component

These sound like valuable components to have for folks who are working with HF tools and models.

When you're ready, please submit a project proposal.

@rcrowe-google

actually, the project proposal has been merged a while ago. the thing is I have suggested two separate custom components, but we decided to merge two into one.

https://github.com/tensorflow/tfx-addons/blob/main/proposals/20220823-huggingface_model_pusher.md