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

ImageNet example issue on Torch with CPU support #275

Closed
ticlazau opened this issue Apr 8, 2021 · 1 comment
Closed

ImageNet example issue on Torch with CPU support #275

ticlazau opened this issue Apr 8, 2021 · 1 comment

Comments

@ticlazau
Copy link

ticlazau commented Apr 8, 2021

Hello,

I am trying to run on CPU only, no CUDA available and I am facing the following issue:

  • python main.py data -e -a 'efficientnet-b0' --pretrained
Loaded pretrained weights for efficientnet-b0
=> using pre-trained model 'efficientnet-b0'
Traceback (most recent call last):
  File "main.py", line 443, in <module>
    main()
  File "main.py", line 117, in main
    main_worker(args.gpu, ngpus_per_node, args)
  File "main.py", line 180, in main_worker
    model = torch.nn.DataParallel(model).cuda()
  File "/Users/coredump/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 491, in cuda
    return self._apply(lambda t: t.cuda(device))
  File "/Users/coredump/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 387, in _apply
    module._apply(fn)
  File "/Users/coredump/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 387, in _apply
    module._apply(fn)
  File "/Users/coredump/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 409, in _apply
    param_applied = fn(param)
  File "/Users/coredump/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 491, in <lambda>
    return self._apply(lambda t: t.cuda(device))
  File "/Users/coredump/anaconda3/lib/python3.8/site-packages/torch/cuda/__init__.py", line 164, in _lazy_init
    raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

Is anything I am missing?

Rgds,
FM

@lukemelas
Copy link
Owner

You should find the places in main.py with .cuda() and remove .cuda() (it should be around 5 places, the first of which is line 180, which caused your issue).

I'm going to close this issue, but re-open it (or just comment) if you have any more questions!

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