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

ModuleNotFoundError: No module named 'fused_adam_cuda' #633

Open
Zhaoxiaolistudy opened this issue Nov 27, 2019 · 9 comments
Open

ModuleNotFoundError: No module named 'fused_adam_cuda' #633

Zhaoxiaolistudy opened this issue Nov 27, 2019 · 9 comments

Comments

@Zhaoxiaolistudy
Copy link

hello,ModuleNotFoundError: No module named 'fused_adam_cuda'

linux
pytorch 3.7
cuda9.2

Has been an error:ModuleNotFoundError: No module named 'fused_adam_cuda'。

git clone https://github.com/NVIDIA/apex
$ cd apex
$ pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./

$` pip install -v --no-cache-dir ./

python setup.py install --cuda_ext --cpp_ext

注释掉setup.py中版本检查那段,都试过了,还是有错
Comment out the check of version in setup.py, i've tried everything above, there are still mistakes。 No module named 'fused_adam_cuda'。

@pfZhu
Copy link

pfZhu commented Dec 20, 2019

you can try FusedAdam in apex.optimizers instead of in apex.optimizers.contrib

@dj123jary
Copy link

@Zhaoxiaolistudy 我也碰到这个问题了,现在解决了吗?猜测是fused_adam_cuda.cpp文件没有编译成功,但检查了编译过程,没看到这个文件的编译

@dj123jary
Copy link

@pfZhu 好像不行,会提示FusedAdam已升级,不建议使用

@pfZhu
Copy link

pfZhu commented Dec 27, 2019

@pfZhu 好像不行,会提示FusedAdam已升级,不建议使用

你是希望用老版本的fp16训练的写法吗?那样的话最好切换apex的commit到之前的版本

@myndtt
Copy link

myndtt commented Feb 29, 2020

@Zhaoxiaolistudy 我也碰到这个问题了,现在解决了吗?猜测是fused_adam_cuda.cpp文件没有编译成功,但检查了编译过程,没看到这个文件的编译

!python -c 'import importlib;importlib.import_module("fused_adam_cuda")' 确实没有这个库 老哥 现在有解决办法么

@qinkun-210
Copy link

我也碰到了这个问题,请问有解决的吗?

@ryotatomioka
Copy link

ryotatomioka commented Apr 7, 2021

You need to add --deprecated_fused_adam in setup.py or --global-option="--deprecated_fused_adam" in your pip install command.

See:

apex/setup.py

Lines 255 to 272 in a651e2c

if "--deprecated_fused_adam" in sys.argv:
from torch.utils.cpp_extension import CUDAExtension
sys.argv.remove("--deprecated_fused_adam")
from torch.utils.cpp_extension import BuildExtension
cmdclass['build_ext'] = BuildExtension
if torch.utils.cpp_extension.CUDA_HOME is None:
raise RuntimeError("--deprecated_fused_adam was requested, but nvcc was not found. Are you sure your environment has nvcc available? If you're installing within a container from https://hub.docker.com/r/pytorch/pytorch, only images whose names contain 'devel' will provide nvcc.")
else:
ext_modules.append(
CUDAExtension(name='fused_adam_cuda',
sources=['apex/contrib/csrc/optimizers/fused_adam_cuda.cpp',
'apex/contrib/csrc/optimizers/fused_adam_cuda_kernel.cu'],
include_dirs=[os.path.join(this_dir, 'csrc')],
extra_compile_args={'cxx': ['-O3',] + version_dependent_macros,
'nvcc':['-O3',
'--use_fast_math'] + version_dependent_macros}))

@dajiji
Copy link

dajiji commented Jul 29, 2021

Niubi. ryotatomioka 的办法 works

@ZhangGQ0014
Copy link

you can try FusedAdam in apex.optimizers instead of in apex.optimizers.contrib

在哪里改代码啊

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

8 participants