1
0
Fork 0

fix(api): GC during SDXL conversion

This commit is contained in:
Sean Sube 2023-12-23 22:34:05 -06:00
parent f6e6e31789
commit a5a60d3e15
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
1 changed files with 5 additions and 0 deletions

View File

@ -10,6 +10,7 @@ from onnxruntime.transformers.float16 import convert_float_to_float16
from optimum.exporters.onnx import main_export
from ...constants import ONNX_MODEL, ONNX_WEIGHTS
from ...utils import run_gc
from ..client import fetch_model
from ..utils import RESOLVE_FORMATS, ConversionContext, check_ext
@ -79,6 +80,10 @@ def convert_diffusion_diffusers_xl(
logger.debug("exporting torch model for %s: %s", source, temp_path)
pipeline.save_pretrained(temp_path)
# GC temporary pipeline
del pipeline
run_gc()
# directory -> onnx using optimum exporters
main_export(
temp_path,