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

make stable diffusion unet and vae number of channels static #1840

Merged
merged 1 commit into from
May 15, 2024
Merged
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
12 changes: 6 additions & 6 deletions optimum/exporters/onnx/model_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ class UNetOnnxConfig(VisionOnnxConfig):
@property
def inputs(self) -> Dict[str, Dict[int, str]]:
common_inputs = {
"sample": {0: "batch_size", 1: "num_channels", 2: "height", 3: "width"},
"sample": {0: "batch_size", 2: "height", 3: "width"},
"timestep": {0: "steps"},
"encoder_hidden_states": {0: "batch_size", 1: "sequence_length"},
}
Expand All @@ -998,7 +998,7 @@ def inputs(self) -> Dict[str, Dict[int, str]]:
@property
def outputs(self) -> Dict[str, Dict[int, str]]:
return {
"out_sample": {0: "batch_size", 1: "num_channels", 2: "height", 3: "width"},
"out_sample": {0: "batch_size", 2: "height", 3: "width"},
}

@property
Expand Down Expand Up @@ -1045,13 +1045,13 @@ class VaeEncoderOnnxConfig(VisionOnnxConfig):
@property
def inputs(self) -> Dict[str, Dict[int, str]]:
return {
"sample": {0: "batch_size", 1: "num_channels", 2: "height", 3: "width"},
"sample": {0: "batch_size", 2: "height", 3: "width"},
}

@property
def outputs(self) -> Dict[str, Dict[int, str]]:
return {
"latent_sample": {0: "batch_size", 1: "num_channels_latent", 2: "height_latent", 3: "width_latent"},
"latent_sample": {0: "batch_size", 2: "height_latent", 3: "width_latent"},
}


Expand All @@ -1069,13 +1069,13 @@ class VaeDecoderOnnxConfig(VisionOnnxConfig):
@property
def inputs(self) -> Dict[str, Dict[int, str]]:
return {
"latent_sample": {0: "batch_size", 1: "num_channels_latent", 2: "height_latent", 3: "width_latent"},
"latent_sample": {0: "batch_size", 2: "height_latent", 3: "width_latent"},
}

@property
def outputs(self) -> Dict[str, Dict[int, str]]:
return {
"sample": {0: "batch_size", 1: "num_channels", 2: "height", 3: "width"},
"sample": {0: "batch_size", 2: "height", 3: "width"},
}


Expand Down
Loading