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

Got unexpected keyword argument "groups" #46

Closed
zendevil opened this issue Sep 1, 2020 · 4 comments
Closed

Got unexpected keyword argument "groups" #46

zendevil opened this issue Sep 1, 2020 · 4 comments

Comments

@zendevil
Copy link

zendevil commented Sep 1, 2020

python3 run.py
initialize
device: cuda
Loading weights: model-f46da743.pt
Downloading: "https://github.com/facebookresearch/WSL-Images/archive/master.zip" to /home/prikshet/.cache/torch/hub/master.zip
Traceback (most recent call last):
File "run.py", line 105, in
run(INPUT_PATH, OUTPUT_PATH, MODEL_PATH)
File "run.py", line 29, in run
model = MidasNet(model_path, non_negative=True)
File "/home/prikshet/midas/midas/midas_net.py", line 30, in init
self.pretrained, self.scratch = _make_encoder(features, use_pretrained)
File "/home/prikshet/midas/midas/blocks.py", line 6, in _make_encoder
pretrained = _make_pretrained_resnext101_wsl(use_pretrained)
File "/home/prikshet/midas/midas/blocks.py", line 26, in _make_pretrained_resnext101_wsl
resnet = torch.hub.load("facebookresearch/WSL-Images", "resnext101_32x8d_wsl")
File "/usr/local/lib/python3.6/dist-packages/torch/hub.py", line 354, in load
model = entry(*args, **kwargs)
File "/home/prikshet/.cache/torch/hub/facebookresearch_WSL-Images_master/hubconf.py", line 39, in resnext101_32x8d_wsl
return _resnext('resnext101_32x8d', Bottleneck, [3, 4, 23, 3], True, progress, **kwargs)
File "/home/prikshet/.cache/torch/hub/facebookresearch_WSL-Images_master/hubconf.py", line 23, in _resnext
model = ResNet(block, layers, **kwargs)
TypeError: init() got an unexpected keyword argument 'groups'

@ranftlr
Copy link
Collaborator

ranftlr commented Sep 1, 2020

You might be using an incompatible version of PyTorch and/or Torchvision. What versions are you using? You can check with:

import torch
import torchvision

print(torch.__version__)
print(torchvision.__version__)

I tested it just now and I don't see the error with PyTorch 1.6.0 and Torchvision 0.7.0.

@ranftlr
Copy link
Collaborator

ranftlr commented Sep 13, 2020

Closing due to inactivity.

@ranftlr ranftlr closed this as completed Sep 13, 2020
@3dsf
Copy link

3dsf commented Nov 12, 2020

just a confirmation, it is related to the torchvision version
conda had installed something below 0.3.0 for me


TypeError: init() got an unexpected keyword argument 'groups'

torchvision version was too low (need 0.3.0 or higher) as per
facebookresearch/WSL-Images#3


if using a conda virtual environment, I'd recommend upgrading via pip
pip3 install torchvision --upgrade

@AlexanderStohr
Copy link

running on Windows

initial state:
torch=1.7.1+cpu
torchvision=0.2.2

this line failed for me - no newer version found:
pip3 install torchvision --upgrade

then i tried this one:
pip install torch==1.5.1+cpu torchvision==0.6.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
(found it there: https://stackoverflow.com/questions/62513412/cannot-install-pip-install-torchvision )

due to some access restriction i finally added "--user" on above

final result:
torch=1.5.1+cpu
torchvision=0.6.1+cpu

and previous dangling operation is now past.

alternate combinations of CPU/CUDA, OS, installer and alikes can be found via the tool here:
https://pytorch.org/get-started/locally/

for more version pairings and indication what might match with your python version:
https://pypi.org/project/torchvision/

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

No branches or pull requests

4 participants