Skip to content

Commit f38e362

Browse files
make style
1 parent 5f826a3 commit f38e362

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

scripts/convert_vae_diff_to_onnx.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,13 @@
1313
# limitations under the License.
1414

1515
import argparse
16-
import os
17-
import shutil
1816
from pathlib import Path
1917

2018
import torch
19+
from packaging import version
2120
from torch.onnx import export
2221

23-
import onnx
24-
from diffusers import OnnxRuntimeModel, OnnxStableDiffusionPipeline, StableDiffusionPipeline, AutoencoderKL
25-
from packaging import version
22+
from diffusers import AutoencoderKL
2623

2724

2825
is_torch_less_than_1_11 = version.parse(version.parse(torch.__version__).base_version) < version.parse("1.11")
@@ -79,9 +76,8 @@ def convert_models(model_path: str, output_path: str, opset: int, fp16: bool = F
7976
output_path = Path(output_path)
8077

8178
# VAE DECODER
82-
vae_decoder = AutoencoderKL.from_pretrained(model_path + "/vae")
79+
vae_decoder = AutoencoderKL.from_pretrained(model_path + "/vae")
8380
vae_latent_channels = vae_decoder.config.latent_channels
84-
vae_out_channels = vae_decoder.config.out_channels
8581
# forward only through the decoder part
8682
vae_decoder.forward = vae_decoder.decode
8783
onnx_export(

0 commit comments

Comments
 (0)