Skip to content

AttributeError: 'torch.device' object has no attribute 'gpu_id' #8050

Closed

Description

@KumoLiu
17:11:34  Traceback (most recent call last):
17:11:34    File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
17:11:34      return _run_code(code, main_globals, None,
17:11:34    File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
17:11:34      exec(code, run_globals)
17:11:34    File "/home/jenkins/agent/workspace/Test-Monai-latest-image/monai/bundle/__main__.py", line 31, in <module>
17:11:34      fire.Fire()
17:11:34    File "/usr/local/lib/python3.10/dist-packages/fire/core.py", line 143, in Fire
17:11:34      component_trace = _Fire(component, args, parsed_flag_args, context, name)
17:11:34    File "/usr/local/lib/python3.10/dist-packages/fire/core.py", line 477, in _Fire
17:11:34      component, remaining_args = _CallAndUpdateTrace(
17:11:34    File "/usr/local/lib/python3.10/dist-packages/fire/core.py", line 693, in _CallAndUpdateTrace
17:11:34      component = fn(*varargs, **kwargs)
17:11:34    File "/home/jenkins/agent/workspace/Test-Monai-latest-image/monai/bundle/scripts.py", line 1729, in trt_export
17:11:34      _export(
17:11:34    File "/home/jenkins/agent/workspace/Test-Monai-latest-image/monai/bundle/scripts.py", line 1297, in _export
17:11:34      net = converter(model=net, **kwargs)
17:11:34    File "/home/jenkins/agent/workspace/Test-Monai-latest-image/monai/networks/utils.py", line 965, in convert_to_trt
17:11:34      trt_model = _onnx_trt_compile(
17:11:34    File "/home/jenkins/agent/workspace/Test-Monai-latest-image/monai/networks/utils.py", line 852, in _onnx_trt_compile
17:11:34      trt_model = torch_tensorrt.ts.embed_engine_in_new_module(
17:11:34    File "/usr/local/lib/python3.10/dist-packages/torch_tensorrt/ts/_compiler.py", line 320, in embed_engine_in_new_module
17:11:34      _parse_device(device),
17:11:34    File "/usr/local/lib/python3.10/dist-packages/torch_tensorrt/ts/_compile_spec.py", line 90, in _parse_device
17:11:34      return TorchScriptDevice._from(device_info)._to_internal()
17:11:34    File "/usr/local/lib/python3.10/dist-packages/torch_tensorrt/ts/_Device.py", line 66, in _from
17:11:34      gpu_id=d.gpu_id,
17:11:34  AttributeError: \'torch.device\' object has no attribute \'gpu_id\'

Activity

  1. added a commit that references this issue on Aug 28, 2024
    dda642f
  2. added a commit that references this issue on Aug 29, 2024
    29ce1a7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions