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

Improve Hugging Face integration #50

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

Conversation

NielsRogge
Copy link

@NielsRogge NielsRogge commented Aug 14, 2024

This PR showcases how a VGGSfM model can be safely pushed to the hub using the PyTorchModelHubMixin. It leverages safetensors to safely store the weights.

By inherting from this class, the following automatically works:

from vggsfm.models.vggsfm import VGGSfM

model = VGGSfM.from_pretrained("nielsr/vggsfm")

# push a trained model to the hub
model.push_to_hub("nielsr/my-new-vggsfm-model")

# save locally as safetensors
model.save_pretrained("path_to_local_folder")

The model is here for now: https://huggingface.co/nielsr/vggsfm, but we can push it to the facebook org instead. As can be seen, download stats also work, along with automated tags ("image-to-3D") and model card:

Screenshot 2024-08-15 at 12 41 04

The entire init arguments are serialized as well into a single config.json: https://huggingface.co/nielsr/vggsfm/blob/main/config.json.

I pushed the model using this Colab notebook.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants