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

Integrate with huggingface #11

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

not-lain
Copy link

this pr will mainly add 3 methods to michelangelo

  • save_pretrained
  • push_to_hub
  • from_pretrained: initialize and load the model weights

allowing your models to be easily integrated with huggingface using the PyTorchModelHubMixin class, I made this notebook https://colab.research.google.com/drive/1rStTsfAqoT7wXijt4a2wPbd6ZUYG3jTc?usp=sharing explaining how to migrate your weights
by the end of the notebook, all users can load your model simply by

!!pip install -qU git+https://github.com/not-lain/Michelangelo.git@integrate-with-huggingface # or your main branch when this is merged
# no more renitializing the model and manually downloading the weights

from michelangelo.models.asl_diffusion.clip_asl_diffuser_pl_module import ClipASLDiffuser
# will instantiate the model and load the weights automatically
new_model = ClipASLDiffuser.from_pretrained("not-lain/Michelangelo")

Why you should integrate your model with huggingface ?

  • easily save, load and push your model
  • Keep track on how many times your model has been downloaded by the community (download metrics will be enabled again)
  • Automatic model card generation: the metadata in the card allows you to filter your searches easily to check how many michelangelo models exist on the Hub.
  • Recommended: after this pr is merged we can open a pull request on this file to make the "michelangelo" library official on the Hub meaning better discoverability + possibility to add code snippets.

do not hesitate if you have any reviews on the pr or any questions.

Kind regards,
Hafedh Hichri

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.

1 participant