Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

AttributeError: module ‘torch.cuda’ has no attribute ‘amp’ #1327

Open
suresh-s opened this issue Dec 16, 2021 · 5 comments
Open

AttributeError: module ‘torch.cuda’ has no attribute ‘amp’ #1327

suresh-s opened this issue Dec 16, 2021 · 5 comments

Comments

@suresh-s
Copy link

Issue : AttributeError: module ‘torch.cuda’ has no attribute ‘amp’

Traceback (most recent call last):
File “tools/train_net.py”, line 15, in
from maskrcnn_benchmark.data import make_data_loader
File “/miniconda3/lib/python3.7/site-packages/maskrcnn_benchmark/data/ init .py”, line 2, in
from .build import make_data_loader
File “/miniconda3/lib/python3.7/site-packages/maskrcnn_benchmark/data/build.py”, line 11, in
from . import datasets as D
File “/miniconda3/lib/python3.7/site-packages/maskrcnn_benchmark/data/datasets/ init .py”, line 3, in
from .coco import COCODataset
File “/miniconda3/lib/python3.7/site-packages/maskrcnn_benchmark/data/datasets/coco.py”, line 6, in
from maskrcnn_benchmark.structures.segmentation_mask import SegmentationMask
File “/miniconda3/lib/python3.7/site-packages/maskrcnn_benchmark/structures/segmentation_mask.py”, line 5, in
from maskrcnn_benchmark.layers.misc import interpolate
File “/miniconda3/lib/python3.7/site-packages/maskrcnn_benchmark/layers/ init .py”, line 10, in
from .nms import nms
File “/miniconda3/lib/python3.7/site-packages/maskrcnn_benchmark/layers/nms.py”, line 5, in
from apex import amp
File “/miniconda3/lib/python3.7/site-packages/apex/ init .py”, line 23, in
from . import transformer
File “/miniconda3/lib/python3.7/site-packages/apex/transformer/ init .py”, line 1, in
from apex.transformer import amp
File “/miniconda3/lib/python3.7/site-packages/apex/transformer/amp/ init .py”, line 1, in
from apex.transformer.amp.grad_scaler import GradScaler
File “/miniconda3/lib/python3.7/site-packages/apex/transformer/amp/grad_scaler.py”, line 8, in
class GradScaler(torch.cuda.amp.GradScaler):
AttributeError: module ‘torch.cuda’ has no attribute ‘amp’

Environment:
GPU : RTX 8000
CUDA: 10.0
Pytorch 1.0.1
torchvision 0.2.2
apex 0.1

Question:

If i use RTX 8000 CUDA 10.0 on the above software environment, I am getting error " AttributeError: module ‘torch.cuda’ has no attribute ‘amp’ "

What is the issue? How can i solve it?

@huahuabai
Copy link

Issue : AttributeError: module ‘torch.cuda’ has no attribute ‘amp’

Traceback (most recent call last): File “tools/train_net.py”, line 15, in from maskrcnn_benchmark.data import make_data_loader File “/miniconda3/lib/python3.7/site-packages/maskrcnn_benchmark/data/ init .py”, line 2, in from .build import make_data_loader File “/miniconda3/lib/python3.7/site-packages/maskrcnn_benchmark/data/build.py”, line 11, in from . import datasets as D File “/miniconda3/lib/python3.7/site-packages/maskrcnn_benchmark/data/datasets/ init .py”, line 3, in from .coco import COCODataset File “/miniconda3/lib/python3.7/site-packages/maskrcnn_benchmark/data/datasets/coco.py”, line 6, in from maskrcnn_benchmark.structures.segmentation_mask import SegmentationMask File “/miniconda3/lib/python3.7/site-packages/maskrcnn_benchmark/structures/segmentation_mask.py”, line 5, in from maskrcnn_benchmark.layers.misc import interpolate File “/miniconda3/lib/python3.7/site-packages/maskrcnn_benchmark/layers/ init .py”, line 10, in from .nms import nms File “/miniconda3/lib/python3.7/site-packages/maskrcnn_benchmark/layers/nms.py”, line 5, in from apex import amp File “/miniconda3/lib/python3.7/site-packages/apex/ init .py”, line 23, in from . import transformer File “/miniconda3/lib/python3.7/site-packages/apex/transformer/ init .py”, line 1, in from apex.transformer import amp File “/miniconda3/lib/python3.7/site-packages/apex/transformer/amp/ init .py”, line 1, in from apex.transformer.amp.grad_scaler import GradScaler File “/miniconda3/lib/python3.7/site-packages/apex/transformer/amp/grad_scaler.py”, line 8, in class GradScaler(torch.cuda.amp.GradScaler): AttributeError: module ‘torch.cuda’ has no attribute ‘amp’

Environment: GPU : RTX 8000 CUDA: 10.0 Pytorch 1.0.1 torchvision 0.2.2 apex 0.1

Question:

If i use RTX 8000 CUDA 10.0 on the above software environment, I am getting error " AttributeError: module ‘torch.cuda’ has no attribute ‘amp’ "

What is the issue? How can i solve it?

请问您解决了吗?我也遇到了这个问题,查出来的结果是torch版本应该改在1.4.0以上,但是作者给出的torch需要1.0,请问您最后问题解决了吗?

@shwetkm
Copy link

shwetkm commented May 2, 2022

Were you able to solve it @suresh-s?
To resolve this #1236 I installed Pytorch 1.4 but now facing "module ‘torch.cuda’ has no attribute ‘amp’" issue. To resolve the latter issue the PyTorch version should be greater than 1.6. Not sure what is the correct solution.

@ninishu
Copy link

ninishu commented Jul 21, 2022

Issue : AttributeError: module ‘torch.cuda’ has no attribute ‘amp’
Traceback (most recent call last): File “tools/train_net.py”, line 15, in from maskrcnn_benchmark.data import make_data_loader File “/miniconda3/lib/python3.7/site-packages/maskrcnn_benchmark/data/ init .py”, line 2, in from .build import make_data_loader File “/miniconda3/lib/python3.7/site-packages/maskrcnn_benchmark/data/build.py”, line 11, in from . import datasets as D File “/miniconda3/lib/python3.7/site-packages/maskrcnn_benchmark/data/datasets/ init .py”, line 3, in from .coco import COCODataset File “/miniconda3/lib/python3.7/site-packages/maskrcnn_benchmark/data/datasets/coco.py”, line 6, in from maskrcnn_benchmark.structures.segmentation_mask import SegmentationMask File “/miniconda3/lib/python3.7/site-packages/maskrcnn_benchmark/structures/segmentation_mask.py”, line 5, in from maskrcnn_benchmark.layers.misc import interpolate File “/miniconda3/lib/python3.7/site-packages/maskrcnn_benchmark/layers/ init .py”, line 10, in from .nms import nms File “/miniconda3/lib/python3.7/site-packages/maskrcnn_benchmark/layers/nms.py”, line 5, in from apex import amp File “/miniconda3/lib/python3.7/site-packages/apex/ init .py”, line 23, in from . import transformer File “/miniconda3/lib/python3.7/site-packages/apex/transformer/ init .py”, line 1, in from apex.transformer import amp File “/miniconda3/lib/python3.7/site-packages/apex/transformer/amp/ init .py”, line 1, in from apex.transformer.amp.grad_scaler import GradScaler File “/miniconda3/lib/python3.7/site-packages/apex/transformer/amp/grad_scaler.py”, line 8, in class GradScaler(torch.cuda.amp.GradScaler): AttributeError: module ‘torch.cuda’ has no attribute ‘amp’
Environment: GPU : RTX 8000 CUDA: 10.0 Pytorch 1.0.1 torchvision 0.2.2 apex 0.1
Question:
If i use RTX 8000 CUDA 10.0 on the above software environment, I am getting error " AttributeError: module ‘torch.cuda’ has no attribute ‘amp’ "
What is the issue? How can i solve it?

请问您解决了吗?我也遇到了这个问题,查出来的结果是torch版本应该改在1.4.0以上,但是作者给出的torch需要1.0,请问您最后问题解决了吗?

安装的 pytorch 1.7.0可以解决 好像1.6以上都可以

@ninishu
Copy link

ninishu commented Jul 22, 2022 via email

@monsterlyg
Copy link

不知道为什么作者要求1.0哎 但是确实是提高版本解决的 我今天跑的时候发现1.7在绘制可视化结果的时候有点问题 现在改成了1.6版本的 

------------------ 原始邮件 ------------------ 发件人: "facebookresearch/maskrcnn-benchmark" @.>; 发送时间: 2022年7月21日(星期四) 晚上11:03 @.>; @.@.>; 主题: Re: [facebookresearch/maskrcnn-benchmark] AttributeError: module ‘torch.cuda’ has no attribute ‘amp’ (Issue #1327) 您好 请问您是把pytorch提高版本解决的吗 但是作者不是要求1.0版本的pytorch吗 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

1.7版本在导入maskrcnn_benckmark时,from maskrcnn_benchmark import _C 会遇到错误?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants