Giter Site home page Giter Site logo

Comments (8)

zacario-li avatar zacario-li commented on May 21, 2024

@lanteng77 You mean train or test?
If test, modify the line from 'cuda:0' to 'cpu'
predictor = Predictor(cfg, args.model, logger, device='cuda:0')

from nanodet.

lanteng77 avatar lanteng77 commented on May 21, 2024

I don't have a GPU, so training needs to be modified.

from nanodet.

RangiLyu avatar RangiLyu commented on May 21, 2024

I don't have a GPU, so training needs to be modified.
Sorry, nanodet current not support cpu training. You can try to change all .to('cuda') to .to('cpu') in this project. But I can't make sure that it will work. Just have a try.

from nanodet.

lanteng77 avatar lanteng77 commented on May 21, 2024

thk, this is very useful for me. I will try.

from nanodet.

zhongguogu avatar zhongguogu commented on May 21, 2024
(nanodet) gu@local:/home/marchinelearning/nanodet$ python demo/demo.py image --config config/nanodet-m.yml   --model model/nanodet_m.pth  --path input/1.jpg 
model size is  1.0x
init weights...
=> loading pretrained model https://download.pytorch.org/models/shufflenetv2_x1-5666bf0f80.pth
Finish initialize Lite GFL Head.
[root][11-25 22:09:37]INFO:Press "Esc", "q" or "Q" to exit.
Traceback (most recent call last):
  File "demo/demo.py", line 107, in <module>
    main()
  File "demo/demo.py", line 90, in main
    meta, res = predictor.inference(image_name)
  File "demo/demo.py", line 53, in inference
    results = self.model.inference(meta)
  File "/home/marchinelearning/nanodet/nanodet/model/arch/one_stage.py", line 34, in inference
    torch.cuda.synchronize()
  File "/home/gu/anaconda3/envs/nanodet/lib/python3.8/site-packages/torch/cuda/__init__.py", line 378, in synchronize
    _lazy_init()
  File "/home/gu/anaconda3/envs/nanodet/lib/python3.8/site-packages/torch/cuda/__init__.py", line 166, in _lazy_init
    raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

i have modified the line from 'cuda:0' to 'cpu'
predictor = Predictor(cfg, args.model, logger, device='cuda:0') => predictor = Predictor(cfg, args.model, logger, device='cpu'),
but still throw an exception.

from nanodet.

RangiLyu avatar RangiLyu commented on May 21, 2024
(nanodet) gu@local:/home/marchinelearning/nanodet$ python demo/demo.py image --config config/nanodet-m.yml   --model model/nanodet_m.pth  --path input/1.jpg 
model size is  1.0x
init weights...
=> loading pretrained model https://download.pytorch.org/models/shufflenetv2_x1-5666bf0f80.pth
Finish initialize Lite GFL Head.
[root][11-25 22:09:37]INFO:Press "Esc", "q" or "Q" to exit.
Traceback (most recent call last):
  File "demo/demo.py", line 107, in <module>
    main()
  File "demo/demo.py", line 90, in main
    meta, res = predictor.inference(image_name)
  File "demo/demo.py", line 53, in inference
    results = self.model.inference(meta)
  File "/home/marchinelearning/nanodet/nanodet/model/arch/one_stage.py", line 34, in inference
    torch.cuda.synchronize()
  File "/home/gu/anaconda3/envs/nanodet/lib/python3.8/site-packages/torch/cuda/__init__.py", line 378, in synchronize
    _lazy_init()
  File "/home/gu/anaconda3/envs/nanodet/lib/python3.8/site-packages/torch/cuda/__init__.py", line 166, in _lazy_init
    raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

i have modified the line from 'cuda:0' to 'cpu'
predictor = Predictor(cfg, args.model, logger, device='cuda:0') => predictor = Predictor(cfg, args.model, logger, device='cpu'),
but still throw an exception.

Try to comment out all torch.cuda.synchronize().

from nanodet.

siva-wellnesys avatar siva-wellnesys commented on May 21, 2024

still the issue is same @RangiLyu
i tried these things
1)Try to comment out all torch.cuda.synchronize()
2) have modified the line from 'cuda:0' to 'cpu'
3) changed all .to('cuda') to .to('cpu')

still facing this same issue

File "/home/marchinelearning/nanodet/nanodet/model/arch/one_stage.py", line 34, in inference
torch.cuda.synchronize()
File "/home/gu/anaconda3/envs/nanodet/lib/python3.8/site-packages/torch/cuda/init.py", line 378, in synchronize
_lazy_init()
File "/home/gu/anaconda3/envs/nanodet/lib/python3.8/site-packages/torch/cuda/init.py", line 166, in _lazy_init
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

is there any alternative for this code to run on CPU?

from nanodet.

wwdok avatar wwdok commented on May 21, 2024

@siva-wellnesys There is still a torch.cuda.synchronize() you didn't comment out, this issue should be solved by above discussion.

from nanodet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.