def convert_opset_to_21_proto(self, model_proto: ModelProto) -> ModelProto:
        """Modify the model's opset to 21 if it's not already, operating on a ModelProto.

        Args:
            model_proto (ModelProto): The ONNX model proto to modify.

        Returns:
            ModelProto: The updated ONNX model proto with opset version 21.

        """
        current_opset = {opset.domain: opset.version for opset in model_proto.opset_import}

        default_domain_version = current_opset.get("", 0)
        if default_domain_version >= 21:
            logger.debug(
                "Model already uses opset version %s for the default domain. Skip conversion.", default_domain_version
            )
            return model_proto  # No conversion needed

        new_opset_imports = [
            helper.make_opsetid("", 21),  # Default domain with opset version 21
            helper.make_opsetid("com.microsoft", 1),  # Microsoft domain with version 1
        ]

        for domain, version in current_opset.items():
            if domain not in ["", "com.microsoft"]:
                new_opset_imports.append(helper.make_opsetid(domain, version))

        # Update the model's opset imports
        model_proto.ClearField("opset_import")
        model_proto.opset_import.extend(new_opset_imports)

        logger.debug("Model opset successfully converted to 21.")

        return model_proto
Modify the model's opset to 21 if it's not already, operating on a ModelProto.

        Args:
            model_proto (ModelProto): The ONNX model proto to modify.

        Returns:
            ModelProto: The updated ONNX model proto with opset version 21.

        
olive/passes/onnx/nvmo_quantization.py