Giter VIP home page Giter VIP logo

torch2trt's People

Contributors

geoffreychen777 avatar traveller59 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

torch2trt's Issues

missing handler aten::group_norm

While converting pytorch model into trt I faced error. Please guide me how to fix it.

Exception has occurred: AssertionError
missing handler aten::group_norm, available handlers: ['prim::Cons....

tensorRT error

when using trt.Builder(TRT_LOGGER) as builder, an error came out:

[TensorRT] ERROR: Cuda initialization failure with error 1. Please check cuda installation:  http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html.
Traceback (most recent call last):
  File "torch2trt.py", line 4, in <module>
    import torch2trt
  File "/home/aisimba/Documents/second.pytorch-v1.6/scripts/torch2trt.py", line 12, in <module>
    with trt.Builder(TRT_LOGGER) as builder, builder.create_network() as trt_net:
TypeError: pybind11::init(): factory function returned nullptr
import torch
import torchvision
import tensorrt as trt 
import torch2trt
TRT_LOGGER = trt.Logger(trt.Logger.INFO)
# trt.Logger(trt.Logger.INFO)

# net = torchvision.models.inception_v3(pretrained=True).eval()
net = torchvision.models.squeezenet1_1(pretrained=True).eval()
inputs = torch.rand(1, 3, 416, 416)

with trt.Builder(TRT_LOGGER) as builder, builder.create_network() as trt_net:
    pass

OS: Ubuntu 16.04
Python3.6
CUDA 10.1
TensorRT 5.1.2-1

Inference is failed after loading the engine file

Hi,

Here is my environment setting:

CentOS 7.0
PyTorch 1.1.0
TensorRT 5.1.2.2 with CUDA9.0
CUDA9.0
cuDNN7.5.0 with CUDA9.0
Python3.6.8

After installed the dependencies of this repo.
I tried the test.py, and serialized the engine into file "test.engine"

Then I try to load it and execute the inference as normal tensorrt python code, as below:

def get_engine(engine_file):
        with open(engine_file,"rb") as f, trt.Runtime(TRT_LOGGER) as runtime:
                print("Engine Loaded")
                return runtime.deserialize_cuda_engine(f.read())
        return None

if __name__ == '__main__':
    img = np.random.rand(1, 3,299,299)
    img /= 255.0
    img -= 0.5
    img *= 2.0
    bindings = []
    img = np.ascontiguousarray(img)                                                                                                                                
    engine = get_engine('test.engine')                                                                                                                            
    stream = cuda.Stream()
    context = engine.create_execution_context()
    output = np.empty(1000, dtype = np.float32)
    d_input = cuda.mem_alloc(1 * img.nbytes)
    d_output = cuda.mem_alloc(1 * output.nbytes)
    bindings = [int(d_input), int(d_output)]
    cuda.memcpy_htod_async(d_input, img, stream)
    context.execute_async(1, bindings, stream.handle, None)
    cuda.memcpy_dtoh_async(output, d_output, stream)
    stream.synchronize()

Then I get below error:

$ python3 test_run.py
Engine Loaded
[TensorRT] WARNING: TensorRT was compiled against cuDNN 7.5.0 but is linked against cuDNN 7.5.1. This mismatch may potentially cause undefined behavior.
[TensorRT] WARNING: TensorRT was compiled against cuDNN 7.5.0 but is linked against cuDNN 7.5.1. This mismatch may potentially cause undefined behavior.
[TensorRT] ERROR: Parameter check failed at: engine.cpp::enqueue::451, condition: bindings[x] != nullptr

Any advice will be welcome.
Thanks,

error with basic example

test with basic example code, an error occured:

Traceback (most recent call last):
  File "trt_test.py", line 27, in <module>
    trt_mode_out = graph_pth(img, verbose=True)
  File "/home/aisimba/.local/lib/python3.6/site-packages/torch2trt-1.0.0-py3.6.egg/torch2trt/core.py", line 665, in __call__
  File "/home/aisimba/.local/lib/python3.6/site-packages/torch2trt-1.0.0-py3.6.egg/torch2trt/core.py", line 497, in resolve_graph
  File "/home/aisimba/.local/lib/python3.6/site-packages/torch2trt-1.0.0-py3.6.egg/torch2trt/core.py", line 492, in resolve_graph
  File "/home/aisimba/.local/lib/python3.6/site-packages/torch2trt-1.0.0-py3.6.egg/torch2trt/handlers/constant.py", line 46, in prim_int
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

can you have this code docker-image?

Hi, @traveller59 , I will have two questions:

1、this torch2trt project could transfer the second model to tensorrt(especially pointpillars) successfully ?

2、if so, can you have this project docker images ?

Thanks.

failed to inference

environment:
tensorrt:6.0.1.5 cuda:10.0 cudnn:7.6.0
i use the serialized resnet50.onnx which from the torchvision.models.resnet50.

eror log
[TensorRT] WARNING: TensorRT was linked against cuDNN 7.6.3 but loaded cuDNN 7.6.0 [TensorRT] WARNING: TensorRT was linked against cuDNN 7.6.3 but loaded cuDNN 7.6.0 [TensorRT] ERROR: ../rtSafe/cuda/cudaPoolingRunner.cpp (84) - Cudnn Error in execute: 8 (CUDNN_STATUS_EXECUTION_FAILED) [TensorRT] ERROR: FAILED_EXECUTION: std::exception
can u give me some advice? thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.