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

import apex always have AttributeError: module 'torch' has no attribute 'library' #1870

Open
Cominder opened this issue Jan 4, 2025 · 9 comments

Comments

@Cominder
Copy link

Cominder commented Jan 4, 2025

always have
Traceback (most recent call last):
File "", line 1, in
File "/root/apex/apex/init.py", line 26, in
from . import normalization
File "/root/apex/apex/normalization/init.py", line 1, in
from .fused_layer_norm import FusedLayerNorm, MixedFusedLayerNorm, FusedRMSNorm, MixedFusedRMSNorm
File "/root/apex/apex/normalization/fused_layer_norm.py", line 70, in
if supports_custom_op():
File "/root/apex/apex/normalization/fused_layer_norm.py", line 18, in supports_custom_op
return hasattr(torch.library, "custom_op")
AttributeError: module 'torch' has no attribute 'library'。

no matter cuda10.1+torch1.6.0/1.7.1 python3.7 or cuda11.1+torch1.8.0 python3.8 or cuda11.3+torch1.10.1 python3.8, apex did nnot work!

Image

@Cominder Cominder changed the title always AttributeError: module 'torch' has no attribute 'library' import apex always have AttributeError: module 'torch' has no attribute 'library' Jan 4, 2025
@GG0614
Copy link

GG0614 commented Jan 5, 2025

Did you solve it?

@Cominder
Copy link
Author

Cominder commented Jan 5, 2025

Did you solve it?  你解决了吗?

NO, still bothers me

@GG0614
Copy link

GG0614 commented Jan 5, 2025

Did you solve it?  你解决了吗?

NO, still bothers me

you can try apex-22.02-parallel-state,I solve this problem just now
cuda11.3+torch1.10.1+torchvision0.11.2+torchaudio0.10.1

@Cominder
Copy link
Author

Cominder commented Jan 5, 2025

Did you solve it?  你解决了吗?

NO, still bothers me  不,仍然困扰着我

you can try apex-22.02-parallel-state,I solve this problem just now你可以试试apex-22.02-parallel-state,我刚刚解决了这个问题 cuda11.3+torch1.10.1+torchvision0.11.2+torchaudio0.10.1

where to get apex-22.02-parallel-state? I can not find it. and python version? no 22.02

Image

@Cominder
Copy link
Author

Cominder commented Jan 6, 2025

git clone https://github.com/NVIDIA/apex.git
cd apex
git tag # if not wanted version
git branch -r
git checkout origin/22.02-parallel-state # or another vesion
python setup.py install --cuda_ext --cpp_ext
pip3 install -v --no-cache-dir ./

@GG0614
Copy link

GG0614 commented Jan 6, 2025

git clone https://github.com/NVIDIA/apex.git cd apex git tag # if not wanted version git branch -r git checkout origin/22.02-parallel-state # or another vesion python setup.py install --cuda_ext --cpp_ext pip3 install -v --no-cache-dir ./

yes,you can try

@Malloy99
Copy link

Malloy99 commented Jan 7, 2025

git clone https://github.com/NVIDIA/apex.git cd apex git tag # if not wanted version git branch -r git checkout origin/22.02-parallel-state # or another vesion python setup.py install --cuda_ext --cpp_ext pip3 install -v --no-cache-dir ./

Thanks for your answer, I have solved it.

cuda11.3+torch1.10.1+torchvision0.11.2+torchaudio0.10.1

@QLYYLQ
Copy link

QLYYLQ commented Jan 19, 2025

git clone https://github.com/NVIDIA/apex.git cd apex git tag # if not wanted version git branch -r git checkout origin/22.02-parallel-state # or another vesion python setup.py install --cuda_ext --cpp_ext pip3 install -v --no-cache-dir ./

It works in cuda 11.3, thank you a lot

@rzw520
Copy link

rzw520 commented Feb 3, 2025

我用这个版本成功解决了
git clone https://github.com/ptrblck/apex.git
cd apex
git checkout apex_no_distributed
pip install -v --no-cache-dir ./

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

5 participants