Skip to content

Commit

Permalink
fix(api): GC during SDXL conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Dec 24, 2023
1 parent f6e6e31 commit a5a60d3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/onnx_web/convert/diffusion/diffusion_xl.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
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

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit a5a60d3

Please sign in to comment.