Unable to run TensorRT notebook: "ModuleNotFoundError: No module named 'tensorrt.helper'"

Hello,

I’m trying to run the “Optimization and Deployment of TensorFlow Models with TensorRT” notebook but I’m having issues.

It prints the following error:

ModuleNotFoundError: No module named 'tensorrt.helper'

The same for graphs

ModuleNotFoundError: No module named 'tensorrt.graph_utils'

Here is the output for

!dpkg -l | grep nvinfer

:

ii  libnvinfer-bin                         6.0.1-1+cuda10.2                   amd64        TensorRT binaries
ii  libnvinfer-dev                         6.0.1-1+cuda10.2                   amd64        TensorRT development libraries and headers
ii  libnvinfer-plugin-dev                  6.0.1-1+cuda10.2                   amd64        TensorRT plugin libraries
ii  libnvinfer-plugin6                     6.0.1-1+cuda10.2                   amd64        TensorRT plugin libraries
ii  libnvinfer6                            6.0.1-1+cuda10.2                   amd64        TensorRT runtime libraries
ii  python3-libnvinfer                     6.0.1-1+cuda10.2                   amd64        Python 3 bindings for TensorRT
ii  python3-libnvinfer-dev                 6.0.1-1+cuda10.2                   amd64        Python 3 development package for TensorRT

I’m using the docker image

nvcr.io/nvidia/tensorflow:19.11-tf1-py3

and running

/opt/tensorrt/python/python_setup.sh

at the end:

FROM nvcr.io/nvidia/tensorflow:19.11-tf1-py3

RUN apt-get update && apt-get install -y --no-install-recommends \
        git \
        apt-utils \
        nfs-common \
        cifs-utils \
        ssh \
        libsm6 \
        libxext6 \
        libopencv-dev \
        uff-converter-tf \
        libxrender-dev

RUN pip install jupyter jupyterlab matplotlib scipy numpy opencv-python fasteners scikit-image tqdm numba sklearn filterpy
RUN /opt/tensorrt/python/python_setup.sh

EXPOSE 8888

COPY execute_jupyter.sh /opt/

WORKDIR /opt/

CMD ["/bin/bash"]

Can you guys please help me on this?

Thank you in advance!

Hi,

There are additional util functions added in the “Optimization and Deployment of TensorFlow Models with TensorRT” code under “tensorrt” directory and not part of TensorRT library.

To view this files, go to “File-> open…” under jupyter notebook.

Thanks

Hello,

I’m facing the same issue.

There is no folder tensorrt under my jupyter notebook.

This is everything I have inside TF-TRT notebook :

~/TF-TRT
├── ~/TF-TRT/TF-TRT.html
├── ~/TF-TRT/TF-TRT_files
│   ├── ~/TF-TRT/TF-TRT_files/4k.png
│   ├── ~/TF-TRT/TF-TRT_files/DLI\ Header.png
│   ├── ~/TF-TRT/TF-TRT_files/GIE_Graphics_FINAL-1.png
│   ├── ~/TF-TRT/TF-TRT_files/MathJax.js.download
│   ├── ~/TF-TRT/TF-TRT_files/accuracy.png
│   ├── ~/TF-TRT/TF-TRT_files/detection-comparision.png
│   ├── ~/TF-TRT/TF-TRT_files/dp4a-updated.png
│   ├── ~/TF-TRT/TF-TRT_files/fit.png
│   ├── ~/TF-TRT/TF-TRT_files/jquery.min.js.download
│   ├── ~/TF-TRT/TF-TRT_files/network_horizontal_fusion.png
│   ├── ~/TF-TRT/TF-TRT_files/network_optimization.png
│   ├── ~/TF-TRT/TF-TRT_files/network_vertical_fusion.png
│   ├── ~/TF-TRT/TF-TRT_files/pipeline.png
│   ├── ~/TF-TRT/TF-TRT_files/require.min.js.download
│   └── ~/TF-TRT/TF-TRT_files/table1.png
└── ~/TF-TRT/main.ipynb

Where can I get this helper file?

The same here.

Hi,

Are you referring to the “Optimization and Deployment of TensorFlow Models with TensorRT” course GPU task code?
If yes, then you should see this kind of folder structure after clicking on “File-> open…” under jupyter notebook of that task.

  • classification
  • images
  • tensorrt (Containes helper and graph_utils files)
  • main-zh.ipynb
  • main.ipynb

Otherwise, could you please share the source code which you are referring in this case?

Thanks

Hello @SunilJB,

I’ve sent it to you thru PV.

I’m running the jupyter notebook over the docket file mentioned in my first post, not in the training environment.

Please let me know if it should work.

Thank you!

Hi,

Not able to access the code on the provided link.
But are you using the same code base of DLI task? If yes, could you please compare the files in your folder and the DLI task folder?

Thanks

Hi,

I’ve sent you the updated link.

But my file structure is exactly as the one below:

There is possible to share the missing utils “tensorrt” folder?

Thanks!