NVIDIA / NVIDIA/apex

RuntimeError: apex.optimizers.FusedAdam requires cuda extensions

Open
#1,193 19 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
9k
Forks
1.5k
Avg merge
2d 4h
Merged PRs (30d)
3

Description

My environment is configured as Windows server2016, torch 1.8.1, torchvision 0.9.1, cuda10.2, apex is successfully installed, but when running the project code (NVlabs/imagenaire), an error is reported:

Initialize net_G and net_D weights using type: orthogonal gain: 1
net_G parameter count: 30,258,966
net_D parameter count: 32,322,498
Traceback (most recent call last):
File "H:\19xyy\project\imaginaire-master\train.py", line 100, in
main()
File "H:\19xyy\project\imaginaire-master\train.py", line 60, in main
get_model_optimizer_and_scheduler(cfg, seed=args.seed)
File "H:\19xyy\project\imaginaire-master\imaginaire\utils\trainer.py", line 115, in get_model_optimizer_and_scheduler
opt_G = get_optimizer(cfg.gen_opt, net_G)
File "H:\19xyy\project\imaginaire-master\imaginaire\utils\trainer.py", line 257, in get_optimizer
return get_optimizer_for_params(cfg_opt, params)
File "H:\19xyy\project\imaginaire-master\imaginaire\utils\trainer.py", line 274, in get_optimizer_for_params
opt = FusedAdam(params,
File "G:\Anaconda3\envs\xyy_imagenaire\lib\site-packages\apex\optimizers\fused_adam.py", line 80, in init
raise RuntimeError('apex.optimizers.FusedAdam requires cuda extensions')
RuntimeError: apex.optimizers.FusedAdam requires cuda extensions

The versions of nvcc -V and print(torch.version.cuda) are the same. I don’t know why this error is reported. Are there any good suggestions to make the code run correctly? Looking forward to your reply, thank you very much!
161
162

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with imaginaire/utils/trainer.py, especially get_optimizer_for_params, and compare its FusedAdam call with apex/optimizers/fused_adam.py where the reported exception is raised. Check how the CUDA extensions were installed for the stated Windows, PyTorch, and CUDA versions, then run train.py to confirm the error no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
24/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.