Skip to content
ProGamerGov edited this page Sep 29, 2019 · 28 revisions

Error Messages


Permission Issues:

 -bash: ./starry_stanford.sh: Permission denied

Solution: Run chmod u+x ./starry_stanford.sh.

-gpu Issues:

Traceback (most recent call last):
  File "/usr/local/bin/neural-style", line 485, in <module>
    main()
  File "/usr/local/bin/neural-style", line 268, in main
    optimizer.step(feval)
  File "/usr/local/lib/python3.5/dist-packages/torch/optim/lbfgs.py", line 307, in step
    orig_loss = closure()
  File "/usr/local/bin/neural-style", line 257, in feval
    loss += mod.loss.to(backward_device)
RuntimeError: CUDA error: invalid device ordinal
Traceback (most recent call last):
  File "neural_style.py", line 474, in <module>
    main()
  File "neural_style.py", line 257, in main
    optimizer.step(feval)
  File "/usr/local/lib/python3.5/dist-packages/torch/optim/lbfgs.py", line 307, in step
    orig_loss = closure()
  File "neural_style.py", line 241, in feval
    loss += mod.loss.to(backward_device)
RuntimeError: CUDA error: invalid device ordinal

Cause: You listed/gave a device number to -gpu that doesn't exist.

Image size issues

Traceback (most recent call last):
  File "neural_style.py", line 474, in <module>
    main()
  File "neural_style.py", line 163, in main
    net(content_image)
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 491, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/container.py", line 91, in forward
    input = module(input)
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 491, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/pooling.py", line 547, in forward
    self.padding, self.ceil_mode, self.count_include_pad)
RuntimeError: Given input size: (1000x5x10). Calculated output size: (1000x0x5). Output size is too small at /home/ubuntu/pytorch/aten/src/THCUNN/generic/SpatialAveragePooling.cu:63
Traceback (most recent call last):
  File "neural_style.py", line 474, in <module>
    main()
  File "neural_style.py", line 163, in main
    net(content_image)
  File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 547, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/container.py", line 92, in forward
    input = module(input)
  File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 547, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/pooling.py", line 141, in forward
    self.return_indices)
  File "/usr/local/lib/python3.5/dist-packages/torch/_jit_internal.py", line 134, in fn
    return if_false(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/torch/nn/functional.py", line 487, in _max_pool2d
    input, kernel_size, stride, padding, dilation, ceil_mode)
RuntimeError: Given input size: (512x1x1). Calculated output size: (512x0x0). Output size is too small

Cause: The value used for -image_size is too small.

Incorrect Layer Names

Traceback (most recent call last):
  File "neural_style.py", line 474, in <module>
    main()
  File "neural_style.py", line 257, in main
    optimizer.step(feval)
  File "/usr/local/lib/python2.7/dist-packages/torch/optim/lbfgs.py", line 103, in step
    orig_loss = closure()
  File "neural_style.py", line 248, in feval
    loss.backward()
AttributeError: 'int' object has no attribute 'backward'
Traceback (most recent call last):
  File "neural_style.py", line 474, in <module>
    main()
  File "neural_style.py", line 257, in main
    optimizer.step(feval)
  File "/usr/local/lib/python2.7/dist-packages/torch/optim/adam.py", line 57, in step
    loss = closure()
  File "neural_style.py", line 248, in feval
    loss.backward()
AttributeError: 'int' object has no attribute 'backward'

Solution: If you were using the nin_imagenet.pth (NIN) model, you either forgot to specify the layers to use with -content_layers -style_layers, or you used invalid layers. NIN has different layer names than the VGG models.

Driver Errors:

Traceback (most recent call last):
  File "/usr/local/bin/neural-style", line 428, in <module>
    main()
  File "/usr/local/bin/neural-style", line 65, in main
    dtype = setup_gpu()
  File "/usr/local/bin/neural-style", line 293, in setup_gpu
    torch.cuda.set_device(params.gpu)
  File "/usr/local/lib/python3.5/dist-packages/torch/cuda/__init__.py", line 281, in set_device
    torch._C._cuda_setDevice(device)
  File "/usr/local/lib/python3.5/dist-packages/torch/cuda/__init__.py", line 178, in _lazy_init
    _check_driver()
  File "/usr/local/lib/python3.5/dist-packages/torch/cuda/__init__.py", line 108, in _check_driver
    of the CUDA driver.""".format(str(torch._C._cuda_getDriverVersion())))
AssertionError:
The NVIDIA driver on your system is too old (found version 9000).
Please update your GPU driver by downloading and installing a new
version from the URL: http://www.nvidia.com/Download/index.aspx
Alternatively, go to: https://pytorch.org to install
a PyTorch version that has been compiled with your version
of the CUDA driver.
Traceback (most recent call last):
  File "/usr/local/bin/neural-style", line 428, in <module>
    main()
  File "/usr/local/bin/neural-style", line 65, in main
    dtype = setup_gpu()
  File "/usr/local/bin/neural-style", line 293, in setup_gpu
    torch.cuda.set_device(params.gpu)
  File "/usr/local/lib/python3.5/dist-packages/torch/cuda/__init__.py", line 281, in set_device
    torch._C._cuda_setDevice(device)
  File "/usr/local/lib/python3.5/dist-packages/torch/cuda/__init__.py", line 178, in _lazy_init
    _check_driver()
  File "/usr/local/lib/python3.5/dist-packages/torch/cuda/__init__.py", line 108, in _check_driver
    of the CUDA driver.""".format(str(torch._C._cuda_getDriverVersion())))
AssertionError:
The NVIDIA driver on your system is too old (found version 9010).
Please update your GPU driver by downloading and installing a new
version from the URL: http://www.nvidia.com/Download/index.aspx
Alternatively, go to: https://pytorch.org to install
a PyTorch version that has been compiled with your version
of the CUDA driver.

Solution: You will need to update your drivers if you wish to use the downloaded version of PyTorch.


Clone this wiki locally