From 714d1639be33c0d6215ee94ecbb3240754a29c0c Mon Sep 17 00:00:00 2001 From: HoopyFreud Date: Tue, 6 Feb 2024 14:24:36 -0500 Subject: [PATCH 1/4] Update documentation --- docs/server-admin.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/server-admin.md b/docs/server-admin.md index 530fdcec2..076867966 100644 --- a/docs/server-admin.md +++ b/docs/server-admin.md @@ -229,6 +229,9 @@ These extra images can be helpful when debugging inpainting, especially poorly b - unload UNet after converting and reload before ControlNet conversion - `ONNX_WEB_CONVERT_OPSET` - ONNX opset used when converting models +- `ONNX_WEB_CONVERT_VALIDATE` + - perform validation after model conversion + - disable to accelerate conversion and save memory - `ONNX_WEB_CONVERT_CPU_ONLY` - perform conversion on the CPU, even if a CUDA GPU is available - can allow conversion of models that do not fit in VRAM From ad617b924fd88477937c7141314c15f82d17f51c Mon Sep 17 00:00:00 2001 From: HoopyFreud Date: Tue, 6 Feb 2024 14:25:47 -0500 Subject: [PATCH 2/4] Add validation env variable check --- api/onnx_web/convert/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/api/onnx_web/convert/utils.py b/api/onnx_web/convert/utils.py index 6b4dca351..60a9af036 100644 --- a/api/onnx_web/convert/utils.py +++ b/api/onnx_web/convert/utils.py @@ -82,6 +82,7 @@ def from_environ(cls): context.reload = get_boolean(environ, "ONNX_WEB_CONVERT_RELOAD", True) context.share_unet = get_boolean(environ, "ONNX_WEB_CONVERT_SHARE_UNET", True) context.opset = int(environ.get("ONNX_WEB_CONVERT_OPSET", DEFAULT_OPSET)) + context.validate = get_boolean(environ, "ONNX_WEB_CONVERT_VALIDATE", True) cpu_only = get_boolean(environ, "ONNX_WEB_CONVERT_CPU_ONLY", False) if cpu_only: From 33931f202c17391a934af33f4ef67f7e7c0f570e Mon Sep 17 00:00:00 2001 From: HoopyFreud Date: Tue, 6 Feb 2024 14:26:24 -0500 Subject: [PATCH 3/4] Support validation check --- api/onnx_web/convert/diffusion/diffusion.py | 1 + api/onnx_web/convert/diffusion/diffusion_xl.py | 1 + 2 files changed, 2 insertions(+) diff --git a/api/onnx_web/convert/diffusion/diffusion.py b/api/onnx_web/convert/diffusion/diffusion.py index 969d0ea2d..39cac8645 100644 --- a/api/onnx_web/convert/diffusion/diffusion.py +++ b/api/onnx_web/convert/diffusion/diffusion.py @@ -850,6 +850,7 @@ def convert_diffusion_diffusers_optimum( "torch-fp16" ), # optimum's fp16 mode only works on CUDA or ROCm framework="pt", + do_validation=conversion.validate, ) if "hash" in model: diff --git a/api/onnx_web/convert/diffusion/diffusion_xl.py b/api/onnx_web/convert/diffusion/diffusion_xl.py index 59708fa73..90ee4418f 100644 --- a/api/onnx_web/convert/diffusion/diffusion_xl.py +++ b/api/onnx_web/convert/diffusion/diffusion_xl.py @@ -94,6 +94,7 @@ def convert_diffusion_diffusers_xl( "torch-fp16" ), # optimum's fp16 mode only works on CUDA or ROCm framework="pt", + do_validation=conversion.validate, ) if "hash" in model: From 02b7716379a09ffca0fbb9780c477084d9636b0d Mon Sep 17 00:00:00 2001 From: HoopyFreud Date: Tue, 6 Feb 2024 14:55:37 -0500 Subject: [PATCH 4/4] Fix tile counter message --- api/onnx_web/chain/tile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/onnx_web/chain/tile.py b/api/onnx_web/chain/tile.py index e8e1baff2..cda9e7d89 100644 --- a/api/onnx_web/chain/tile.py +++ b/api/onnx_web/chain/tile.py @@ -272,7 +272,7 @@ def process_tile_stack( for counter, (left, top) in enumerate(tile_coords): logger.info( - "processing tile %s of %s, %sx%s", counter, len(tile_coords), left, top + "processing tile %s of %s, %sx%s", counter+1, len(tile_coords), left, top ) right = left + tile