naver / dust3r

DUSt3R: Geometric 3D Vision Made Easy
https://dust3r.europe.naverlabs.com/
Other
5.1k stars 556 forks source link

Add Hugging Face integration #16

Closed NielsRogge closed 5 months ago

NielsRogge commented 7 months ago

Hey,

thanks for this great model!

I though it'd be nice to leverage the PyTorchModelHubMixin class, which allows to add from_pretrained and push_to_hub capabilities to any custom nn.Module, which means you'll get download metrics for your models, people can easily discover these models (if we tag them with "3D vision", etc.)

Now you can do:

from dust3r.model import AsymmetricCroCo3DStereo

model = AsymmetricCroCo3DStereo.from_pretrained("nielsr/DUSt3R_ViTLarge_BaseDecoder_512_dpt")

The model is here: https://huggingface.co/nielsr/DUSt3R_ViTLarge_BaseDecoder_512_dpt_bis.

Here's a notebook to showcase its usage: https://colab.research.google.com/drive/1CQu_sAWhGyuKcuXCqOB4lunqXgOXCeAW?usp=sharing.

Of course, we could move the checkpoints to the NAVER organization on the hub rather than my personal username (nielsr).

Kind regards,

Niels ML @ HF

NielsRogge commented 5 months ago

Gentle ping @yocabon

NielsRogge commented 5 months ago

Hi @yocabon I saw you pushed a commit. As can be seen, download metrics are working (shown on the right):

Screenshot 2024-04-13 at 11 45 47

If you could push the Dust3R checkpoints under your username (or the organization name of NAVER): https://huggingface.co/naver, I can update the README in this PR to replace my username "nielsr" by the new name.

Would you be able to push them? I'm happy to help.

Basically now people don't need to manually download a checkpoint first, it will download automatically from the hub + increment the download counts

yocabon commented 5 months ago

Hi, thanks for the suggestions. Because I'd like to make the integration optional and more importantly to keep being able to load local checkpoints; I made it a little more complicated in the branch. I managed to upload the checkpoints to the naver organization without any issue (for now it's still in private). I'll discuss this with the others and maybe merge later if they're okay with it.

Please tell me if you also have remarks.

yocabon commented 5 months ago

Done with #78

NielsRogge commented 5 months ago

Thanks @yocabon, that works for me. The integration looks nice! cc @wauplin for visibility

NielsRogge commented 4 months ago

Hi @yocabon looks like the HF integration is a great success, the model has been downloaded more than 200k times last 30 days! 🚀

Screenshot 2024-06-03 at 09 31 40

I opened a PR to add the "mixin" tag so we can track the downloads: https://huggingface.co/naver/DUSt3R_ViTLarge_BaseDecoder_512_dpt/discussions/1. This way we can see which models which are using the mixin have the most amount of downloads.

Thanks!