Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create and implement an env flag for validation checking during model conversion #466

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/onnx_web/chain/tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions api/onnx_web/convert/diffusion/diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions api/onnx_web/convert/diffusion/diffusion_xl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions api/onnx_web/convert/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions docs/server-admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down