Skip to content

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

@GoblinCraftman

Description

@GoblinCraftman

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions