in optimum/exporters/onnx/model_configs.py [0:0]
def outputs(self) -> Dict[str, Dict[int, str]]:
common_outputs = {}
if self.model_part == "text_encoder":
common_outputs = super().outputs
elif self.model_part == "encodec_decode":
common_outputs["audio_values"] = {0: "batch_size", 2: "audio_length"}
elif self.model_part == "build_delay_pattern_mask":
common_outputs["input_ids_edited"] = {0: "total_batch_size_x_num_codebooks"}
common_outputs["delay_pattern_mask"] = {0: "total_batch_size_x_num_codebooks", 1: "max_length"}
elif self._behavior is ConfigBehavior.DECODER:
common_outputs = super().outputs
# MusicgenForConditionalGeneration output is named logits, not last_hidden_state.
# Rename last_hidden_state -> logits while keeping the order.
common_outputs = {
"logits" if name == "last_hidden_state" else name: value for name, value in common_outputs.items()
}
else:
raise ValueError(
"This should not happen. Please open an issue at https://github.com/huggingface/optimum/issues."
)
return common_outputs