seongmin-kye / MCT

Pytorch implementation of Meta-Learned Confidence for Few-shot Learning
71 stars 12 forks source link

max_pool2d_with_indices_out_cuda_frame failed with error code 0 #8

Closed thezealousfool closed 4 years ago

thezealousfool commented 4 years ago

Hi I tried running the code on miniImagenet using the command

python train.py --is_train True --gpu 1 --transductive True --flip True --drop True --n_shot 1 --n_train_class 15

But I get the following error

Traceback (most recent call last):
  File "train.py", line 114, in <module>
    loss = model.train(images, labels)
  File "../utils/model.py", line 154, in train
    original_key = self.model(images)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 532, in __call__
    result = self.forward(*input, **kwargs)
  File "../utils/backbone/resnet12.py", line 93, in forward
    x = self.layer3(x)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 532, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/container.py", line 100, in forward
    input = module(input)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 532, in __call__
    result = self.forward(*input, **kwargs)
  File "../utils/backbone/resnet12.py", line 42, in forward
    out = self.maxpool(out)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 532, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/pooling.py", line 139, in forward
    return F.max_pool2d(input, self.kernel_size, self.stride,
  File "/usr/local/lib/python3.8/dist-packages/torch/_jit_internal.py", line 181, in fn
    return if_false(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/functional.py", line 487, in _max_pool2d
    return torch.max_pool2d(
RuntimeError: max_pool2d_with_indices_out_cuda_frame failed with error code 0

I am using the pickle files provided in the README. PyTorch version 1.4

Can you help me with this? Thanks

thezealousfool commented 4 years ago

Fixed the error with the help of this

Changed mini_ImageNet/utils/model.py line 149 and line 196 from

images = self.make_input(images)

to

images = self.make_input(images).contiguous()