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

UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead #2017

Closed
Alibhji opened this issue Jan 25, 2020 · 14 comments · Fixed by #2105

Comments

@Alibhji
Copy link

Alibhji commented Jan 25, 2020

Hello,
I have installed:
Pytorch 1.4.0
cuda: 10.1

after running:
python3 tools/train.py ./configs/ssd300_coco.py

Training will be started but with this warning, Is there any Idea to remove it?

2020-01-24 18:31:56,041 - INFO - Start running, host: ali@ali-ubt, work_dir: /home/ali/00_2020/mmdetection/work_dirs/ssd300_coco
2020-01-24 18:31:56,041 - INFO - workflow: [('train', 1)], max: 24 epochs
/pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.
/pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.
/pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.
/pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.

@ZwwWayne
Copy link
Collaborator

A first guess is here, for now, you can try to remove the .type(torch.uint8) and also set related variables to be bool somewhere.
Thanks for your kind notification, we will also fix this warning in the future.

@CMobley7
Copy link

CMobley7 commented Jan 29, 2020

I can confirm this issue. I've tried PyTorch versions from 1.4 to 1.2 and still receive the error. However, with PyTorch 1.1 this warning doesn't occur.

@CMobley7
Copy link

When this change is implemented, can it be back-ported into 1.0?

@ZwwWayne
Copy link
Collaborator

ZwwWayne commented Feb 1, 2020

This change should be independent, so you can fix it in your environment.

@prateek-77
Copy link

You can add this in train.py while training (to ignore the warning):

import warnings
warnings.filterwarnings("ignore", category=UserWarning)

@EvenStrangest
Copy link

The below task also produces this error.

root@1bac3eaaf785:/mmdetection# python tools/train.py configs/htc/htc_x101_64x4d_fpn_20e_16gpu.py
2020-03-10 14:49:23,916 - mmdet - INFO - Environment info:
------------------------------------------------------------
TorchVision: 0.4.1a0+d94043a
OpenCV: 4.2.0
MMCV: 0.3.2
MMDetection: 1.1.0+e08a1ee
MMDetection Compiler: GCC 5.4
MMDetection CUDA Compiler: 10.1

@Holylili
Copy link

Holylili commented Apr 6, 2021

I have also met the same problem, and I can't solve by using the online solutions. If are there anything new methods to solve this problem, please tell me!

@mhiyer
Copy link

mhiyer commented Jul 4, 2021

Change torch.ByteTensor->torch.BoolTensor

@Holylili
Copy link

Holylili commented Jul 5, 2021

Change torch.ByteTensor->torch.BoolTensor

Thank you!

@wulala-max
Copy link

Change torch.ByteTensor->torch.BoolTensor

Thank you!

could tell me more clearly?change torch.ByteTensor->torch.BoolTensor is done in which file?

@wulala-max
Copy link

Change torch.ByteTensor->torch.BoolTensor

Thank you!

thanks!

@wulala-max
Copy link

Change torch.ByteTensor->torch.BoolTensor

could you tell me more clearly? make this change in which file?thank you!

@wulala-max
Copy link

please help me,when I train,I encounter pdb and stop,erro information is below.How can I continue?

2022-04-01 22:13:34,296 - INFO - workflow: [('train', 1)], max: 12 epochs
/pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.
/pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.
/pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.
/pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.
/pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.

/root/desktop/mmdetection_RGBT/mmdet/models/detectors/faster_rcnn_mydata.py(393)forward_train()
-> if self.with_shared_head:
(Pdb)

@Tracy-git
Copy link

Tracy-git commented Mar 10, 2023

`maybe u could convert tensor type like : xx.bool() at the location of the error(warning)。

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

Successfully merging a pull request may close this issue.

9 participants