def _add_metadata(self, onnx_model: onnx.ModelProto, metadata: dict[str, str]) -> onnx.ModelProto:
        """Add metadata to the ONNX model."""
        # Get existing metadata
        existing_metadata = {entry.key: entry.value for entry in onnx_model.metadata_props}

        # Update with new metadata (this will overwrite existing keys)
        existing_metadata.update(metadata)

        # Set the updated metadata
        onnx.helper.set_model_props(onnx_model, existing_metadata)

        return onnx_model
Add metadata to the ONNX model.
olive/passes/onnx/add_metadata.py