Skip to content

Commit

Permalink
feat(api): create model path if needed during convert script
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Jan 31, 2023
1 parent c34ddac commit 6c22cb1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions api/onnx_web/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
)
from logging import getLogger
from onnx import load, save_model
from os import mkdir, path, environ
from os import environ, makedirs, mkdir, path
from pathlib import Path
from shutil import copyfile, rmtree
from sys import exit
Expand Down Expand Up @@ -253,7 +253,7 @@ def convert_diffuser(name: str, url: str, opset: int, half: bool, token: str, si
)
del pipeline.text_encoder

logger.info('UNET config: %s', pipeline.unet.config)
logger.debug('UNET config: %s', pipeline.unet.config)

# UNET
if single_vae:
Expand Down Expand Up @@ -307,7 +307,7 @@ def convert_diffuser(name: str, url: str, opset: int, half: bool, token: str, si
del pipeline.unet

if single_vae:
logger.info('VAE config: %s', pipeline.vae.config)
logger.debug('VAE config: %s', pipeline.vae.config)

# SINGLE VAE
vae_only = pipeline.vae
Expand Down Expand Up @@ -517,6 +517,10 @@ def main() -> int:
args = parser.parse_args()
logger.info('CLI arguments: %s', args)

if path.exists(model_path):
logger.info('Model path does not existing, creating: %s', model_path)
makedirs(model_path)

logger.info('Converting base models.')
load_models(args, base_models)

Expand Down

0 comments on commit 6c22cb1

Please sign in to comment.