lpiccinelli-eth / UniDepth

Universal Monocular Metric Depth Estimation
Other
462 stars 39 forks source link

Releasing the model on torch.hub? #32

Closed gmberton closed 2 months ago

gmberton commented 2 months ago

Could you release the models on torch.hub? It is quite simple to do and allows people to use your model with two lines of code, allowing more people to use your model and helping to spread your work! Once the model is on torch.hub, it is super simple to use without requiring any installation or cloning the repo, e.g. I did it for a model of my own, called CosPlace, which can be used just like this

import torch
model = torch.hub.load("gmberton/cosplace", "get_trained_model", backbone="ResNet50", fc_output_dim=2048)
lpiccinelli-eth commented 2 months ago

Thank you for your question, we removed the description of how to load from TorchHub from the README, to give more space to HuggingFace, but we will re-add it.

However, you can load it through TorchHub as:

version="v1"
backbone="ViTL14"
model = torch.hub.load("lpiccinelli-eth/UniDepth", "UniDepth", version=version, backbone=backbone, pretrained=True, trust_repo=True, force_reload=True)

you can look into hubconf.py for more detail.