NVIDIA / Stable-Diffusion-WebUI-TensorRT

TensorRT Extension for Stable Diffusion Web UI
MIT License
1.91k stars 146 forks source link

ModuleNotFoundError: No module named 'tensorrt_bindings' | tensorrt with New Libraly #342

Closed TimmekHW closed 2 months ago

TimmekHW commented 2 months ago

Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] Version: f2.0.1v1.10.1-previous-218-g643a485d Commit hash: 643a485d1aff11acc657b24ee32d019e28d85b07 removing old version of tensorrt Launching Web UI with arguments: Total VRAM 24564 MB, total RAM 65322 MB pytorch version: 2.4.0+cu124 Set vram state to: NORMAL_VRAM Device: cuda:0 NVIDIA GeForce RTX 4090 : native Hint: your device supports --cuda-malloc for potential speed improvements. VAE dtype preferences: [torch.bfloat16, torch.float32] -> torch.bfloat16 CUDA Using Stream: False G:\webui_forge_cu124_torch24\system\python\lib\site-packages\transformers\utils\hub.py:127: FutureWarning: Using TRANSFORMERS_CACHE is deprecated and will be removed in v5 of Transformers. Use HF_HOME instead. warnings.warn( Using pytorch cross attention Using pytorch attention for VAE ControlNet preprocessor location: G:\webui_forge_cu124_torch24\webui\models\ControlNetPreprocessor ** Error loading script: trt.py Traceback (most recent call last): File "G:\webui_forge_cu124_torch24\webui\modules\scripts.py", line 525, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "G:\webui_forge_cu124_torch24\webui\modules\script_loading.py", line 13, in load_module module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "G:\webui_forge_cu124_torch24\webui\extensions\Stable-Diffusion-WebUI-TensorRT\scripts\trt.py", line 13, in import ui_trt File "G:\webui_forge_cu124_torch24\webui\extensions\Stable-Diffusion-WebUI-TensorRT\ui_trt.py", line 18, in from exporter import export_onnx, export_trt, export_lora File "G:\webui_forge_cu124_torch24\webui\extensions\Stable-Diffusion-WebUI-TensorRT\exporter.py", line 23, in from utilities import Engine File "G:\webui_forge_cu124_torch24\webui\extensions\Stable-Diffusion-WebUI-TensorRT\utilities.py", line 32, in import tensorrt as trt File "G:\webui_forge_cu124_torch24\system\python\lib\site-packages\tensorrt__init__.py", line 18, in from tensorrt_bindings import ModuleNotFoundError: No module named 'tensorrt_bindings'


2024-08-27 18:04:09,451 - ControlNet - INFO - ControlNet UI callback registered. Model selected: {'checkpoint_info': {'filename': 'G:\webui_forge_cu124_torch24\webui\models\Stable-diffusion\flux_dev.safetensors', 'hash': '4af4416b'}, 'vae_filename': None, 'unet_storage_dtype': None} Running on local URL: http://127.0.0.1:7860

To create a public link, set share=True in launch(). Startup time: 9.6s (prepare environment: 2.1s, launcher: 1.3s, import torch: 2.6s, initialize shared: 0.1s, other imports: 0.5s, load scripts: 1.1s, create ui: 1.2s, gradio launch: 0.6s). Environment vars changed: {'stream': False, 'inference_memory': 1024.0, 'pin_shared_memory': False}


Package                     Version
--------------------------- --------------------
absl-py                     2.1.0
accelerate                  0.21.0
addict                      2.4.0
aenum                       3.1.15
aiofiles                    23.2.1
aiohappyeyeballs            2.4.0
aiohttp                     3.10.5
aiosignal                   1.3.1
albumentations              1.3.1
altair                      5.3.0
annotated-types             0.7.0
antlr4-python3-runtime      4.9.3
anyio                       3.7.1
async-timeout               4.0.3
attrs                       24.2.0
basicsr                     1.4.2
bitsandbytes                0.43.3
blendmodes                  2022
certifi                     2024.7.4
cffi                        1.17.0
chardet                     5.2.0
charset-normalizer          3.3.2
clean-fid                   0.1.35
click                       8.1.7
clip                        1.0
colorama                    0.4.6
coloredlogs                 15.0.1
colorlog                    6.8.2
contourpy                   1.2.1
cssselect2                  0.7.0
cycler                      0.12.1
Cython                      3.0.8
datasets                    2.21.0
deprecation                 2.1.0
depth_anything              2024.1.22.0
diffusers                   0.29.2
dill                        0.3.8
diskcache                   5.6.3
easydict                    1.11
einops                      0.4.1
embreex                     2.17.7.post4
exceptiongroup              1.2.0
facexlib                    0.3.0
fastapi                     0.104.1
ffmpy                       0.3.1
filelock                    3.13.1
filterpy                    1.4.5
flatbuffers                 24.3.25
fonttools                   4.53.1
frozenlist                  1.4.1
fsspec                      2024.2.0
ftfy                        6.1.3
future                      0.18.3
fvcore                      0.1.5.post20221221
gitdb                       4.0.11
GitPython                   3.1.32
gradio                      4.40.0
gradio_client               1.2.0
gradio_rangeslider          0.0.6
grpcio                      1.60.1
h11                         0.12.0
handrefinerportable         2024.2.12.0
httpcore                    0.15.0
httpx                       0.24.1
huggingface-hub             0.24.6
humanfriendly               10.0
idna                        3.8
imageio                     2.33.1
importlib-metadata          7.0.1
importlib_resources         6.4.4
inflection                  0.5.1
insightface                 0.7.3
iopath                      0.1.9
jax                         0.4.31
jaxlib                      0.4.31
Jinja2                      3.1.3
joblib                      1.3.2
jsonmerge                   1.8.0
jsonschema                  4.21.1
jsonschema-specifications   2023.12.1
kiwisolver                  1.4.5
kornia                      0.6.7
lark                        1.1.2
lazy_loader                 0.3
lightning-utilities         0.10.1
llvmlite                    0.42.0
lmdb                        1.4.1
lxml                        5.3.0
mapbox-earcut               1.0.1
Markdown                    3.5.2
markdown-it-py              3.0.0
MarkupSafe                  2.1.5
matplotlib                  3.9.2
mdurl                       0.1.2
mediapipe                   0.10.14
ml-dtypes                   0.4.0
mpmath                      1.3.0
multidict                   6.0.5
multiprocess                0.70.16
networkx                    3.2.1
numba                       0.59.0
numpy                       1.26.2
nvidia-cublas-cu12          12.6.0.22
nvidia-cuda-nvrtc-cu12      12.6.20
nvidia-cuda-runtime-cu12    12.6.37
nvidia-cudnn-cu12           9.3.0.75
omegaconf                   2.2.3
onnx                        1.15.0
onnx-graphsurgeon           0.5.2
onnxruntime                 1.17.0
open-clip-torch             2.20.0
opencv-contrib-python       4.10.0.84
opencv-python               4.10.0.84
opencv-python-headless      4.9.0.80
opt-einsum                  3.3.0
optimum                     1.21.4
orjson                      3.9.13
packaging                   24.1
pandas                      2.2.2
piexif                      1.1.3
Pillow                      9.5.0
pillow-avif-plugin          1.4.3
pip                         24.2
platformdirs                4.2.0
polygraphy                  0.49.9
portalocker                 2.10.1
prettytable                 3.9.0
protobuf                    3.20.0
psutil                      5.9.5
pyarrow                     17.0.0
pycollada                   0.8
pycparser                   2.22
pydantic                    2.8.2
pydantic_core               2.20.1
pydub                       0.25.1
Pygments                    2.18.0
pyparsing                   3.1.4
pyreadline3                 3.4.1
python-dateutil             2.9.0.post0
python-multipart            0.0.9
pytorch-lightning           1.9.4
pytz                        2024.1
PyWavelets                  1.5.0
pywin32                     306
PyYAML                      6.0.2
qudida                      0.0.4
referencing                 0.33.0
regex                       2024.7.24
reportlab                   4.2.2
requests                    2.32.3
resize-right                0.0.2
rich                        13.7.1
rpds-py                     0.17.1
Rtree                       1.2.0
ruff                        0.5.5
safetensors                 0.4.2
scikit-image                0.21.0
scikit-learn                1.4.0
scipy                       1.14.1
semantic-version            2.10.0
sentencepiece               0.2.0
setuptools                  69.5.1
shapely                     2.0.2
shellingham                 1.5.4
six                         1.16.0
smmap                       5.0.1
sniffio                     1.3.0
sounddevice                 0.5.0
spandrel                    0.3.4
spandrel_extra_arches       0.1.1
starlette                   0.27.0
svg.path                    6.3
svglib                      1.5.1
sympy                       1.12
tabulate                    0.9.0
tb-nightly                  2.16.0a20240204
tensorboard-data-server     0.7.2
tensorrt-cu12               10.3.0
tensorrt_lean               10.3.0
tensorrt_lean-cu12          10.3.0
tensorrt_lean-cu12_bindings 10.3.0
tensorrt_lean-cu12_libs     10.3.0
termcolor                   2.4.0
tf_keras-nightly            2.16.0.dev2024020410
threadpoolctl               3.2.0
tifffile                    2024.1.30
timm                        1.0.9
tinycss2                    1.3.0
tokenizers                  0.19.1
tomesd                      0.1.3
tomli                       2.0.1
tomlkit                     0.12.0
toolz                       0.12.1
torch                       2.4.0+cu124
torchaudio                  2.4.0+cu124
torchdiffeq                 0.2.3
torchmetrics                1.3.0.post0
torchsde                    0.2.6
torchvision                 0.19.0+cu124
tqdm                        4.66.5
trampoline                  0.1.2
transformers                4.44.0
trimesh                     4.1.3
typer                       0.12.3
typing_extensions           4.9.0
tzdata                      2024.1
urllib3                     2.2.2
uvicorn                     0.27.0.post1
vhacdx                      0.0.5
wcwidth                     0.2.13
webencodings                0.5.1
websockets                  11.0.3
Werkzeug                    3.0.1
wheel                       0.44.0
xxhash                      3.5.0
yacs                        0.1.8
yapf                        0.40.2
yarl                        1.9.4
zipp                        3.17.0```
TimmekHW commented 2 months ago

Как я это пофиксил (я использую https://github.com/lllyasviel/stable-diffusion-webui-forge):

  1. Скопировал environment.bat
  2. Вставил его и переименовал в venv.bat
  3. Добавил в конце cmd /k

set DIR=%~dp0system

set PATH=%DIR%\git\bin;%DIR%\python;%DIR%\python\Scripts;%PATH% set PY_LIBS=%DIR%\python\Scripts\Lib;%DIR%\python\Scripts\Lib\site-packages set PY_PIP=%DIR%\python\Scripts set SKIP_VENV=1 set PIP_INSTALLER_LOCATION=%DIR%\python\get-pip.py set TRANSFORMERS_CACHE=%DIR%\transformers-cache

cmd /k


4. Открыл venv.bat
И уже после этого ввёл нужные команды:
5. pip install --upgrade nvidia-cudnn-cu12
6. pip install --upgrade tensorrt
7. pip install --upgrade optimum-nvidia

И это помогло мне.