question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Errors when testing on CPU

See original GitHub issue
layer_name: <class 'torch.nn.modules.conv.Conv2d'>, total_params: 15121584, total_traina_params: 15121584, n_layers: 39
device:  cpu
Traceback (most recent call last):
  File "main.py", line 208, in <module>
    test(epoch)
  File "main.py", line 189, in test
    outputs = net(inputs)
  File "/home/brcao/Apps/anaconda3/envs/yolo/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/brcao/Repos/pytorch-cifar/models/dla_simple.py", line 106, in forward
    out = self.base(x)
  File "/home/brcao/Apps/anaconda3/envs/yolo/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/brcao/Apps/anaconda3/envs/yolo/lib/python3.8/site-packages/torch/nn/modules/container.py", line 117, in forward
    input = module(input)
  File "/home/brcao/Apps/anaconda3/envs/yolo/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/brcao/Apps/anaconda3/envs/yolo/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 423, in forward
    return self._conv_forward(input, self.weight)
  File "/home/brcao/Apps/anaconda3/envs/yolo/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 419, in _conv_forward
    return F.conv2d(input, weight, self.bias, self.stride,
RuntimeError: Expected object of device type cuda but got device type cpu for argument #1 'self' in call to _thnn_conv2d_forward

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
bryanbocaocommented, Aug 22, 2022

@bryanbocao I started off with the first approach and just added a resize transform, but that loses a lot of information. For datasets like ImageNet, this doesn’t give accuracy above 50%. So I was thinking maybe if I try to make the models accept images of any size, it might give me better results, taking more time training of course.

The codebase on the repo has a lot of hardcoded elements. I combated the 10 output classes by adding an argument for number of classes in every model class. But I don’t have the knowledge to know what’s going on in the complex models to modify them to be able to accept images of any size.

P.S, I’m using a Jupyter notebook instead of my main.py

@Phillibob55 Sounds good. If you would like to create an easy-to-use repo that we can just change some arguments to train and test many different models, I am happy to contribute in my spare time. I have forked you repo to https://github.com/bryanbocao/image-classification

0reactions
Phillibob55commented, Aug 7, 2022

I’ve created a repo for it here

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to test a computer motherboard and CPU for failures
The first thing to do is a visual check of the motherboard. A common cause of motherboard issues or failure is bulged or...
Read more >
How to Test a CPU - Techwalla
A faulty CPU can cause error messages in the testing program, or cause the computer to crash or reboot while testing. If you...
Read more >
How to Identify Which Hardware Component is Failing in Your ...
Blue Screen 101: Search for the Error Message · Check Hard Drive SMART Status · Test Your RAM · Check Heat Levels ·...
Read more >
Troubleshooting Memory Errors - MemTest86
Please be aware that not all errors reported by MemTest86 are due to bad memory. The test implicitly tests the CPU, L1 and...
Read more >
Motherboard or cpu error, how can I test them?
- you need to check all of your fans and confirm they spin up, and are not slowed or clogged by dust (overheating...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found