NVIDIA / Stable-Diffusion-WebUI-TensorRT

TensorRT Extension for Stable Diffusion Web UI
MIT License
1.89k stars 144 forks source link

Can't make new tensorRT/onnx: AssertionError and SystemExit: None #164

Open DuckersMcQuack opened 9 months ago

DuckersMcQuack commented 9 months ago

Can't create new models. Want to find out what messed up.

To create a public link, set share=True in launch(). COMMANDLINE_ARGS does not contain --api, API won't be mounted. Startup time: 36.4s (prepare environment: 13.1s, import torch: 5.2s, import gradio: 0.8s, setup paths: 0.5s, initialize shared: 0.2s, other imports: 0.4s, list SD models: 0.4s, load scripts: 5.1s, create ui: 6.5s, gradio launch: 2.4s, app_started_callback: 1.7s). Exporting neverendingDreamNED_bakedVae to TensorRT {'sample': [(1, 4, 64, 64), (2, 4, 128, 128), (2, 4, 128, 128)], 'timesteps': [(1,), (2,), (2,)], 'encoder_hidden_states': [(1, 77, 768), (2, 77, 768), (2, 231, 768)]} No ONNX file found. Exporting ONNX... Disabling attention optimization ERROR:root: Traceback (most recent call last): File "H:\Stablediff\Automatic1111\webuiDuckers-september\extensions\Stable-Diffusion-WebUI-TensorRT\exporter.py", line 74, in export_onnx inputs = modelobj.get_sample_input( File "H:\Stablediff\Automatic1111\webuiDuckers-september\extensions\Stable-Diffusion-WebUI-TensorRT\models.py", line 977, in get_sample_input latent_height, latent_width = self.check_dims( File "H:\Stablediff\Automatic1111\webuiDuckers-september\extensions\Stable-Diffusion-WebUI-TensorRT\models.py", line 265, in check_dims and latent_height <= self.max_latent_shape AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "H:\Stablediff\Automatic1111\webuiDuckers-september\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict output = await app.get_blocks().process_api( File "H:\Stablediff\Automatic1111\webuiDuckers-september\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api result = await self.call_function( File "H:\Stablediff\Automatic1111\webuiDuckers-september\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function prediction = await anyio.to_thread.run_sync( File "H:\Stablediff\Automatic1111\webuiDuckers-september\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "H:\Stablediff\Automatic1111\webuiDuckers-september\venv\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "H:\Stablediff\Automatic1111\webuiDuckers-september\venv\lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, args) File "H:\Stablediff\Automatic1111\webuiDuckers-september\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper response = f(args, **kwargs) File "H:\Stablediff\Automatic1111\webuiDuckers-september\extensions\Stable-Diffusion-WebUI-TensorRT\ui_trt.py", line 135, in export_unet_to_trt export_onnx( File "H:\Stablediff\Automatic1111\webuiDuckers-september\extensions\Stable-Diffusion-WebUI-TensorRT\exporter.py", line 129, in export_onnx exit() File "C:\Users\Duckers\AppData\Local\Programs\Python\Python310\lib_sitebuiltins.py", line 26, in call raise SystemExit(code) SystemExit: None

rugabunda commented 9 months ago

Same error

KumKaShree commented 9 months ago

open the stable diffusion directory in your terminal, activate your environment with venv\Scripts\activate, and then execute the command pip install onnxruntime. Ensure that you close any running instances of stable diffusion. @DuckersMcQuack @rugabunda

Edit: alternatively, if you attempt to set the resolution of the dynamic presets below the specified resolution, it will fail. for instance, if the minimum resolution is 512x512, you cannot go below this threshold.

contentis commented 9 months ago

Can you share the exact engine configuration you're trying to build? It sounds like you image height doesn't fulfil the requirement min<opt<max