NVIDIA / Stable-Diffusion-WebUI-TensorRT

TensorRT Extension for Stable Diffusion Web UI
MIT License
1.87k stars 141 forks source link

lora_v2 branch fails to start on A1111 V1.7.0 #207

Open silverace71 opened 7 months ago

silverace71 commented 7 months ago

A1111 starts, but not the extension. At launch it just hands me this

Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
Version: v1.7.0
Commit hash: cf2772fab0af5573da775e7437e6acdca424f26e
Launching Web UI with arguments: --xformers --skip-python-version-check
Style database not found: A:\AI\Packages\A1111\styles.csv
*** Error loading script: trt.py
    Traceback (most recent call last):
      File "A:\AI\Packages\A1111\modules\scripts.py", line 469, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "A:\AI\Packages\A1111\modules\script_loading.py", line 10, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "A:\AI\Packages\A1111\extensions\Stable-Diffusion-WebUI-TensorRT\scripts\trt.py", line 13, in <module>
        import ui_trt
      File "A:\AI\Packages\A1111\extensions\Stable-Diffusion-WebUI-TensorRT\ui_trt.py", line 10, in <module>
        from exporter import export_onnx, export_trt, onnx_to_refit_delta
      File "A:\AI\Packages\A1111\extensions\Stable-Diffusion-WebUI-TensorRT\exporter.py", line 13, in <module>
        from utilities import Engine
      File "A:\AI\Packages\A1111\extensions\Stable-Diffusion-WebUI-TensorRT\utilities.py", line 34, in <module>
        import tensorrt as trt
      File "A:\AI\Packages\A1111\venv\lib\site-packages\tensorrt\__init__.py", line 18, in <module>
        from tensorrt_bindings import *
    ModuleNotFoundError: No module named 'tensorrt_bindings'

---
Loading weights [1c3b884d1d] from A:\AI\Packages\A1111\models\Stable-diffusion\himawarimix_v100.safetensors
Running on local URL:  http://127.0.0.1:7860

Seems like an easy fix, but i'm still learning how to code so I have no clue how to add the module tensorrt_bindings (which I am assuming is the fix).

Lilneo786 commented 7 months ago

pip install tensorrt

silverace71 commented 7 months ago

pip install tensorrt

where would I do this? Do I need to add tensorrt in requirements.txt? or just in my webui.bat file?

Lilneo786 commented 7 months ago

Run it in the terminal, then run your original code.

silverace71 commented 7 months ago

Run it in the terminal, then run your original code.

making it install tensorrt did nothing for some reason

Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
Version: v1.7.0
Commit hash: cf2772fab0af5573da775e7437e6acdca424f26e
Installing tensorrt
Looking in indexes: https://pypi.org/simple, https://pypi.nvidia.com
Collecting tensorrt==9.2.0.post12.dev5
  Downloading https://pypi.nvidia.com/tensorrt/tensorrt-9.2.0.post12.dev5.tar.gz (18 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: tensorrt
  Building wheel for tensorrt (setup.py): started
  Building wheel for tensorrt (setup.py): finished with status 'done'
  Created wheel for tensorrt: filename=tensorrt-9.2.0.post12.dev5-py2.py3-none-any.whl size=17638 sha256=cb5c9510805b351c923dff6cf731ce8b7a4d9a997719522999a18a2218de2b1a
  Stored in directory: C:\Users\silver\AppData\Local\Temp\pip-ephem-wheel-cache-6gtdz3py\wheels\aa\96\bf\028c219d3560856a5fdb8b3aec8bf01e9d485521c092a64d02
Successfully built tensorrt
Installing collected packages: tensorrt
  Attempting uninstall: tensorrt
    Found existing installation: tensorrt 9.0.1.post11.dev4
    Uninstalling tensorrt-9.0.1.post11.dev4:
      Successfully uninstalled tensorrt-9.0.1.post11.dev4
Successfully installed tensorrt-9.2.0.post12.dev5
Launching Web UI with arguments: --xformers --skip-python-version-check --no-hashing
Style database not found: A:\AI\Packages\A1111\styles.csv
*** Error loading script: trt.py
    Traceback (most recent call last):
      File "A:\AI\Packages\A1111\modules\scripts.py", line 469, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "A:\AI\Packages\A1111\modules\script_loading.py", line 10, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "A:\AI\Packages\A1111\extensions\Stable-Diffusion-WebUI-TensorRT\scripts\trt.py", line 13, in <module>
        import ui_trt
      File "A:\AI\Packages\A1111\extensions\Stable-Diffusion-WebUI-TensorRT\ui_trt.py", line 10, in <module>
        from exporter import export_onnx, export_trt, onnx_to_refit_delta
      File "A:\AI\Packages\A1111\extensions\Stable-Diffusion-WebUI-TensorRT\exporter.py", line 13, in <module>
        from utilities import Engine
      File "A:\AI\Packages\A1111\extensions\Stable-Diffusion-WebUI-TensorRT\utilities.py", line 34, in <module>
        import tensorrt as trt
      File "A:\AI\Packages\A1111\venv\lib\site-packages\tensorrt\__init__.py", line 18, in <module>
        from tensorrt_bindings import *
    ModuleNotFoundError: No module named 'tensorrt_bindings'

---
Loading weights [1c3b884d1d] from A:\AI\Packages\A1111\models\Stable-diffusion\himawarimix_v100.safetensors
Running on local URL:  http://127.0.0.1:7860

I'm probably going to stick with V1.6.0 until this is fixed

Lilneo786 commented 7 months ago

make you are running your application within the same Python environment where TensorRT is installed. The error might occur if you have multiple Python environments, and your application is using a different one.

Library Path: Check if the 'tensorrt_bindings' module is located in the correct library path. It should be accessible to your Python environment. You can check the paths using the following code:

import sys
print(sys.path)

Make sure that the directory containing 'tensorrt_bindings' is included in the list of paths.

contentis commented 7 months ago

When hitting installation issues please try running this: https://github.com/NVIDIA/Stable-Diffusion-WebUI-TensorRT/issues/27#issuecomment-1767570566

I would recommend testing v1.7 and the dev branch of the extension. It has all the lora goodies but way more stable and supports XL.