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

AttributeError: 'int' object has no attribute 'type' #221

Open
GoblinCraftman opened this issue Feb 11, 2024 · 0 comments
Open

AttributeError: 'int' object has no attribute 'type' #221

GoblinCraftman opened this issue Feb 11, 2024 · 0 comments

Comments

@GoblinCraftman
Copy link

I use python ./tools/train.py configs/swin\cascade_mask_rcnn_swin_small_patch4_window7_mstrain_480-800_giou_4conv1f_adamw_3x_coco.py --work-dir=runs/1/ to train,and get an error:

File "C:\Users\anaconda3\envs\mmd\lib\site-packages\mmcv\parallel_functions.py", line 75, in forward
streams = [_get_stream(device) for device in target_gpus]
File "C:\Users\anaconda3\envs\mmd\lib\site-packages\mmcv\parallel_functions.py", line 75, in
streams = [_get_stream(device) for device in target_gpus]
File "C:\Users\anaconda3\envs\mmd\lib\site-packages\torch\nn\parallel_functions.py", line 118, in _get_stream
if device.type == "cpu":
AttributeError: 'int' object has no attribute 'type'

and I find the code is:
@staticmethod
def forward(target_gpus: List[int], input: Union[List, Tensor]) -> tuple:
input_device = get_input_device(input)
streams = None
if input_device == -1 and target_gpus != [-1]:
# Perform CPU to GPU copies in a background stream
streams = [_get_stream(device) for device in target_gpus]
and the device here is int 0

I believe it's the problem of gpu,I just run on 1 gpu but it make error in synchronize_stream,what should I do?

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

1 participant