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

TypeError: __call__() missing 1 required positional argument: 'view_size' #11

Open
zhaobingbingbing opened this issue Dec 8, 2021 · 1 comment

Comments

@zhaobingbingbing
Copy link

hi,hologerry, thanks for your work, when we run the 'bash SoCo_C4_100ep.sh'
There is an error as follows. Our environment is pytorch 1.10,torchvision 0.11,GPU:A100,CUDA 11.4.
Thanks for your reply.

Traceback (most recent call last):
File "../main_pretrain.py", line 280, in
main(opt)
File "../main_pretrain.py", line 185, in main
train(epoch, train_loader, model, optimizer, scheduler, args, summary_writer)
File "../main_pretrain.py", line 204, in train
for idx, data in enumerate(train_loader):
File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 521, in next
data = self._next_data()
File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1203, in _next_data
return self._process_data(data)
File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1229, in _process_data
<zipfile.ZipFile filename='../../imagenet/traintry.zip' mode='r'>
data.reraise()
File "/opt/conda/lib/python3.8/site-packages/torch/_utils.py", line 425, in reraise
path raise self.exc_type(msg)
TypeError: Caught TypeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
data = fetcher.fetch(index)
File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/workspace/SoCo-main/contrast/data/dataset.py", line 506, in getitem
img2_1x_cut = self.transform[5](img2_1x, resized_bboxs2) # cutout
TypeError: call() missing 1 required positional argument: 'view_size'

@khurramHashmi
Copy link

Hi,

I came across this error too. Although it is a year-old issue, it might be helpful for someone else in the future.
I think the authors have forgotten to add the third positional variable of 'view_size' during the code-cleaning process.
It should be:

img2_1x_cut = self.transform[5](img2_1x, resized_bboxs2, self.view_size) # cutout

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

2 participants