NVIDIA / pix2pixHD

Synthesizing and manipulating 2048x1024 images with conditional GANs
https://tcwang0509.github.io/pix2pixHD/
Other
6.62k stars 1.39k forks source link

i want to accelerate inference by using tensorRT-4.0.1.6, but run_engine.py report errors #72

Open yuxiazff opened 5 years ago

yuxiazff commented 5 years ago

i have download the pre-trained Cityscapes model,and put it under ./checkpoints/label2city_1024p/. it runs successfully with the command: python test.py --name label2city_1024p --netG local --ngf 32 --resize_or_crop none I want to accelerate inference by using tensorRT,so i setup tensorRT-4.0.1.6,and execute the folowing command: python test.py --name label2city_1024p --netG local --ngf 32 --resize_or_crop none --onnx but it report the following error:

CustomDatasetDataLoader dataset [AlignedDataset] was created [libprotobuf ERROR google/protobuf/io/zero_copy_stream_impl.cc:118] close() failed: Bad file descriptor Traceback (most recent call last): File "test.py", line 59, in generated = run_onnx(opt.onnx, opt.data_type, minibatch, [data['label'], data['inst']]) File "/pix2pixHD/run_engine.py", line 157, in run_onnx trt_builder.set_max_batch_size(max_batch_size) NameError: global name 'max_batch_size' is not defined

so i set max_batch_size as 64, max_workspace_size as 100000000,and execute the command again,it report the following error:

CustomDatasetDataLoader dataset [AlignedDataset] was created [libprotobuf ERROR google/protobuf/io/zero_copy_stream_impl.cc:118] close() failed: Bad file descriptor ------------------- Running FP32 ----------------------------- ----- Builder is Done ----- ----- Creating Engine ----- [TensorRT] ERROR: Network must have at least one output ----- Engine is built ----- Traceback (most recent call last): File "test.py", line 59, in generated = run_onnx(opt.onnx, opt.data_type, minibatch, [data['label'], data['inst']]) File "/pix2pixHD/run_engine.py", line 173, in run_onnx time_inference(engine, bs, inp) NameError: global name 'engine' is not defined

so i try to change engine to trt_engine, but it report error again, i do't know how not figure it out. the error is:

CustomDatasetDataLoader dataset [AlignedDataset] was created [libprotobuf ERROR google/protobuf/io/zero_copy_stream_impl.cc:118] close() failed: Bad file descriptor ------------------- Running FP32 ----------------------------- ----- Builder is Done ----- ----- Creating Engine ----- [TensorRT] ERROR: Network must have at least one output ----- Engine is built ----- Traceback (most recent call last): File "test.py", line 59, in generated = run_onnx(opt.onnx, opt.data_type, minibatch, [data['label'], data['inst']]) File "/pix2pixHD/run_engine.py", line 173, in run_onnx time_inference(trt_engine, bs, inp) File "/pix2pixHD/run_engine.py", line 108, in time_inference for io in get_input_output_names(engine): File "/pix2pixHD/run_engine.py", line 63, in get_input_output_names nbindings = trt_engine.get_nb_bindings(); AttributeError: 'NoneType' object has no attribute 'get_nb_bindings'

ai-libo commented 5 years ago

I have the same problem. Have you solved it?

zener90818 commented 4 years ago

Hi, Did you success to accelerate?