-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Pre-trained detection models for PyTorch Hub #1945
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
Comments
Hi, Adding the detection models in ccing @ailzhang to see if there are other options. |
Gotcha. Related, I think Fairseq actually is doing some Cython compilation inside their |
@chenliu0831 understood, that could be a solution for it, although I'm not sure if we should be doing any compilation in the torchhub setup, as it would take a long time to run. |
@fmassa IMHO it's worth adding to make the detection models more accessible. Users will build for the first time, but as we cache the build, they should be good until they force a rebuild. |
We could try adding support for it, although it will require users to have a C++ compiler + nvcc (if using GPUs), which might not always be the case, so we would need to give good error messages in those cases. |
Awesome, I'll take a shot. |
@chenliu0831, any update on this? |
@fmassa, I tried adding the detection models to Note that I did NOT build either pytorch or torchvision from source. I installed them using pip3 install torch==1.10.2+cu113 torchvision==0.11.3+cu113 torchaudio==0.10.2+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
This is the code I used to test the imports: import torch
import torchvision
model = torch.hub.load(
'/home/adeel/vision',
'ssd300_vgg16',
source='local',
num_classes=2,
force_reload=True,
pretrained=False,
pretrained_backbone=False).eval()
model(torch.zeros(1, 3, 300, 300)) Observations
In each failure case, I get this error:
What do you make of this? Is it worth adding the detection models to |
@AdeelH The detection models require custom C++ ops that need compilation. TorchHub can't import models with such dependencies. Right now there is no way to add support. We might look on the future for options but this is quite a sizeable work and it's not going to be done just by adding them on the hubconf.py. |
Thanks for the reply. I get that, but what I've reported above is that importing via torch hub is in fact working in some cases without having to do any additional compilation. If that is known/expected behavior, then I apologize. |
I believe what you describe is expected. The specific version that you have installed will work because the binaries contain the compiled C++/CUDA ops. I'm not an expert on the internals of TorchHub. @NicolasHug do you know if the point 2 on the Observation section above is expected? |
As @datumbox mentioned in general one should not expect models with compiled extensions to work with torchhub. However, since you already have torchvision 0.11 installed, these extensions have been compiled already and are present somewhere on your machine.
|
🚀 Feature
First of all, thanks for the amazing work.
I noticed currently there's no pre-trained detection models exposed via
hub_conf.py
. It looks like the building blocks are already there. Is there plan to support it?Thanks
Motivation
Increase coverage of supported vision tasks via Torch Hub.
Pitch
hub_conf.py
The text was updated successfully, but these errors were encountered: