You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
run projects/easydeploy/model/backendwrapper.py when set device=0 ,the result is right, but set device=1 ,get [TRT] [E] 1: [shapeHostToDeviceRunner.cpp::execute::48] Error Code 1: Cuda Runtime (invalid resource handle)
Environment
Additional information
import warnings
from collections import namedtuple
from functools import partial
from pathlib import Path
from typing import List, Optional, Union
Prerequisite
馃悶 Describe the bug
run projects/easydeploy/model/backendwrapper.py when set device=0 ,the result is right, but set device=1 ,get [TRT] [E] 1: [shapeHostToDeviceRunner.cpp::execute::48] Error Code 1: Cuda Runtime (invalid resource handle)
Environment
Additional information
import warnings
from collections import namedtuple
from functools import partial
from pathlib import Path
from typing import List, Optional, Union
import tensorrt as trt
import torch
warnings.filterwarnings(action='ignore', category=DeprecationWarning)
class TRTWrapper(torch.nn.Module):
dtype_mapping = {}
def init(self, weight: Union[str, Path], device: Optional[torch.device]):
super().init()
weight = Path(weight) if isinstance(weight, str) else weight
assert weight.exists() and weight.suffix in ('.engine', '.trt')
if isinstance(device, str):
device = torch.device(device)
elif isinstance(device, int):
device = torch.device(f'cuda:{device}')
self.weight = weight
self.device = device
self.stream = torch.cuda.Stream(device=device)
self.__update_mapping()
self.__init_engine()
self.__init_bindings()
device = 1
model = TRTWrapper('tensorrt/model_new.trt',device)
inputs =torch.randn(2, 3, 640,640)
outputs = model(inputs)
print(outputs[0])
The text was updated successfully, but these errors were encountered: