prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  check_function requires contexts as arguments which breaks backward compatibility
  https://github.com/onnx/onnx/pull/5693 added required parameters to the `check_function` function in checker which breaks backward compatibility. Should we provide default contexts to `check_function` as well?
  
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `onnx/checker.py`
  Content:
  ```
  1 # Copyright (c) ONNX Project Contributors
  2 #
  3 # SPDX-License-Identifier: Apache-2.0
  4 """Graph utilities for checking whether an ONNX proto message is legal."""
  5 
  6 from __future__ import annotations
  7 
  8 __all__ = [
  9     "check_attribute",
  10     "check_function",
  11     "check_graph",
  12     "check_model",
  13     "check_node",
  14     "check_sparse_tensor",
  15     "check_tensor",
  16     "check_value_info",
  17     "DEFAULT_CONTEXT",
  18     "LEXICAL_SCOPE_CONTEXT",
  19     "ValidationError",
  20     "C",
  21     "MAXIMUM_PROTOBUF",
  22 ]
  23 
  24 import os
  25 import sys
  26 from typing import Any, Callable, TypeVar
  27 
  28 from google.protobuf.message import Message
  29 
  30 import onnx.defs
  31 import onnx.onnx_cpp2py_export.checker as C  # noqa: N812
  32 import onnx.shape_inference
  33 from onnx import (
  34     IR_VERSION,
  35     AttributeProto,
  36     FunctionProto,
  37     GraphProto,
  38     ModelProto,
  39     NodeProto,
  40     SparseTensorProto,
  41     TensorProto,
  42     ValueInfoProto,
  43 )
  44 
  45 # Limitation of single protobuf file is 2GB
  46 MAXIMUM_PROTOBUF = 2000000000
  47 
  48 # TODO: This thing where we reserialize the protobuf back into the
  49 # string, only to deserialize it at the call site, is really goofy.
  50 # Stop doing that.
  51 
  52 
  53 # NB: Please don't edit this context!
  54 DEFAULT_CONTEXT = C.CheckerContext()
  55 DEFAULT_CONTEXT.ir_version = IR_VERSION
  56 # TODO: Maybe ONNX-ML should also be defaulted?
  57 DEFAULT_CONTEXT.opset_imports = {"": onnx.defs.onnx_opset_version()}
  58 
  59 LEXICAL_SCOPE_CONTEXT = C.LexicalScopeContext()
  60 
  61 
  62 FuncType = TypeVar("FuncType", bound=Callable[..., Any])
  63 
  64 
  65 def _ensure_proto_type(proto: Message, proto_type: type[Message]) -> None:
  66     if not isinstance(proto, proto_type):
  67         raise TypeError(
  68             f"The proto message needs to be of type '{proto_type.__name__}'"
  69         )
  70 
  71 
  72 def check_value_info(
  73     value_info: ValueInfoProto, ctx: C.CheckerContext = DEFAULT_CONTEXT
  74 ) -> None:
  75     _ensure_proto_type(value_info, ValueInfoProto)
  76     return C.check_value_info(value_info.SerializeToString(), ctx)
  77 
  78 
  79 def check_tensor(tensor: TensorProto, ctx: C.CheckerContext = DEFAULT_CONTEXT) -> None:
  80     _ensure_proto_type(tensor, TensorProto)
  81     return C.check_tensor(tensor.SerializeToString(), ctx)
  82 
  83 
  84 def check_attribute(
  85     attr: AttributeProto,
  86     ctx: C.CheckerContext = DEFAULT_CONTEXT,
  87     lex_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,
  88 ) -> None:
  89     _ensure_proto_type(attr, AttributeProto)
  90     return C.check_attribute(attr.SerializeToString(), ctx, lex_ctx)
  91 
  92 
  93 def check_node(
  94     node: NodeProto,
  95     ctx: C.CheckerContext = DEFAULT_CONTEXT,
  96     lex_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,
  97 ) -> None:
  98     _ensure_proto_type(node, NodeProto)
  99     return C.check_node(node.SerializeToString(), ctx, lex_ctx)
  100 
  101 
  102 def check_function(
  103     function: FunctionProto,
  104     ctx: C.CheckerContext,
  105     lex_ctx: C.LexicalScopeContext,
  106 ) -> None:
  107     _ensure_proto_type(function, FunctionProto)
  108     C.check_function(function.SerializeToString(), ctx, lex_ctx)
  109 
  110 
  111 def check_graph(
  112     graph: GraphProto,
  113     ctx: C.CheckerContext = DEFAULT_CONTEXT,
  114     lex_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,
  115 ) -> None:
  116     _ensure_proto_type(graph, GraphProto)
  117     return C.check_graph(graph.SerializeToString(), ctx, lex_ctx)
  118 
  119 
  120 def check_sparse_tensor(
  121     sparse: SparseTensorProto, ctx: C.CheckerContext = DEFAULT_CONTEXT
  122 ) -> None:
  123     _ensure_proto_type(sparse, SparseTensorProto)
  124     C.check_sparse_tensor(sparse.SerializeToString(), ctx)
  125 
  126 
  127 def check_model(
  128     model: ModelProto | str | bytes | os.PathLike,
  129     full_check: bool = False,
  130     skip_opset_compatibility_check: bool = False,
  131 ) -> None:
  132     """Check the consistency of a model.
  133 
  134     An exception will be raised if the model's ir_version is not set
  135     properly or is higher than checker's ir_version, or if the model
  136     has duplicate keys in metadata_props.
  137 
  138     If IR version >= 3, the model must specify opset_import.
  139     If IR version < 3, the model cannot have any opset_import specified.
  140 
  141     Args:
  142         model: Model to check. If model is a path, the function checks model
  143             path first. If the model bytes size is larger than 2GB, function
  144             should be called using model path.
  145         full_check: If True, the function also runs shape inference check.
  146         skip_opset_compatibility_check: If True, the function skips the check for
  147             opset compatibility.
  148     """
  149     # If model is a path instead of ModelProto
  150     if isinstance(model, (str, os.PathLike)):
  151         C.check_model_path(os.fspath(model), full_check, skip_opset_compatibility_check)
  152     else:
  153         protobuf_string = (
  154             model if isinstance(model, bytes) else model.SerializeToString()
  155         )
  156         # If the protobuf is larger than 2GB,
  157         # remind users should use the model path to check
  158         if sys.getsizeof(protobuf_string) > MAXIMUM_PROTOBUF:
  159             raise ValueError(
  160                 "This protobuf of onnx model is too large (>2GB). Call check_model with model path instead."
  161             )
  162         C.check_model(protobuf_string, full_check, skip_opset_compatibility_check)
  163 
  164 
  165 ValidationError = C.ValidationError
  166
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/onnx/checker.py b/onnx/checker.py
  --- a/onnx/checker.py
  +++ b/onnx/checker.py
  @@ -84,37 +84,37 @@
   def check_attribute(
       attr: AttributeProto,
       ctx: C.CheckerContext = DEFAULT_CONTEXT,
  -    lex_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,
  +    lexical_scope_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,
   ) -> None:
       _ensure_proto_type(attr, AttributeProto)
  -    return C.check_attribute(attr.SerializeToString(), ctx, lex_ctx)
  +    return C.check_attribute(attr.SerializeToString(), ctx, lexical_scope_ctx)
   
   
   def check_node(
       node: NodeProto,
       ctx: C.CheckerContext = DEFAULT_CONTEXT,
  -    lex_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,
  +    lexical_scope_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,
   ) -> None:
       _ensure_proto_type(node, NodeProto)
  -    return C.check_node(node.SerializeToString(), ctx, lex_ctx)
  +    return C.check_node(node.SerializeToString(), ctx, lexical_scope_ctx)
   
   
   def check_function(
       function: FunctionProto,
  -    ctx: C.CheckerContext,
  -    lex_ctx: C.LexicalScopeContext,
  +    ctx: C.CheckerContext = DEFAULT_CONTEXT,
  +    lexical_scope_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,
   ) -> None:
       _ensure_proto_type(function, FunctionProto)
  -    C.check_function(function.SerializeToString(), ctx, lex_ctx)
  +    C.check_function(function.SerializeToString(), ctx, lexical_scope_ctx)
   
   
   def check_graph(
       graph: GraphProto,
       ctx: C.CheckerContext = DEFAULT_CONTEXT,
  -    lex_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,
  +    lexical_scope_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,
   ) -> None:
       _ensure_proto_type(graph, GraphProto)
  -    return C.check_graph(graph.SerializeToString(), ctx, lex_ctx)
  +    return C.check_graph(graph.SerializeToString(), ctx, lexical_scope_ctx)
   
   
   def check_sparse_tensor(
  
verification_info: {"golden_diff": "diff --git a/onnx/checker.py b/onnx/checker.py\n--- a/onnx/checker.py\n+++ b/onnx/checker.py\n@@ -84,37 +84,37 @@\n def check_attribute(\n     attr: AttributeProto,\n     ctx: C.CheckerContext = DEFAULT_CONTEXT,\n-    lex_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,\n+    lexical_scope_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,\n ) -> None:\n     _ensure_proto_type(attr, AttributeProto)\n-    return C.check_attribute(attr.SerializeToString(), ctx, lex_ctx)\n+    return C.check_attribute(attr.SerializeToString(), ctx, lexical_scope_ctx)\n \n \n def check_node(\n     node: NodeProto,\n     ctx: C.CheckerContext = DEFAULT_CONTEXT,\n-    lex_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,\n+    lexical_scope_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,\n ) -> None:\n     _ensure_proto_type(node, NodeProto)\n-    return C.check_node(node.SerializeToString(), ctx, lex_ctx)\n+    return C.check_node(node.SerializeToString(), ctx, lexical_scope_ctx)\n \n \n def check_function(\n     function: FunctionProto,\n-    ctx: C.CheckerContext,\n-    lex_ctx: C.LexicalScopeContext,\n+    ctx: C.CheckerContext = DEFAULT_CONTEXT,\n+    lexical_scope_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,\n ) -> None:\n     _ensure_proto_type(function, FunctionProto)\n-    C.check_function(function.SerializeToString(), ctx, lex_ctx)\n+    C.check_function(function.SerializeToString(), ctx, lexical_scope_ctx)\n \n \n def check_graph(\n     graph: GraphProto,\n     ctx: C.CheckerContext = DEFAULT_CONTEXT,\n-    lex_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,\n+    lexical_scope_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,\n ) -> None:\n     _ensure_proto_type(graph, GraphProto)\n-    return C.check_graph(graph.SerializeToString(), ctx, lex_ctx)\n+    return C.check_graph(graph.SerializeToString(), ctx, lexical_scope_ctx)\n \n \n def check_sparse_tensor(\n", "issue": "check_function requires contexts as arguments which breaks backward compatibility\nhttps://github.com/onnx/onnx/pull/5693 added required parameters to the `check_function` function in checker which breaks backward compatibility. Should we provide default contexts to `check_function` as well?\r\n\r\n\n", "before_files": [{"content": "# Copyright (c) ONNX Project Contributors\n#\n# SPDX-License-Identifier: Apache-2.0\n\"\"\"Graph utilities for checking whether an ONNX proto message is legal.\"\"\"\n\nfrom __future__ import annotations\n\n__all__ = [\n    \"check_attribute\",\n    \"check_function\",\n    \"check_graph\",\n    \"check_model\",\n    \"check_node\",\n    \"check_sparse_tensor\",\n    \"check_tensor\",\n    \"check_value_info\",\n    \"DEFAULT_CONTEXT\",\n    \"LEXICAL_SCOPE_CONTEXT\",\n    \"ValidationError\",\n    \"C\",\n    \"MAXIMUM_PROTOBUF\",\n]\n\nimport os\nimport sys\nfrom typing import Any, Callable, TypeVar\n\nfrom google.protobuf.message import Message\n\nimport onnx.defs\nimport onnx.onnx_cpp2py_export.checker as C  # noqa: N812\nimport onnx.shape_inference\nfrom onnx import (\n    IR_VERSION,\n    AttributeProto,\n    FunctionProto,\n    GraphProto,\n    ModelProto,\n    NodeProto,\n    SparseTensorProto,\n    TensorProto,\n    ValueInfoProto,\n)\n\n# Limitation of single protobuf file is 2GB\nMAXIMUM_PROTOBUF = 2000000000\n\n# TODO: This thing where we reserialize the protobuf back into the\n# string, only to deserialize it at the call site, is really goofy.\n# Stop doing that.\n\n\n# NB: Please don't edit this context!\nDEFAULT_CONTEXT = C.CheckerContext()\nDEFAULT_CONTEXT.ir_version = IR_VERSION\n# TODO: Maybe ONNX-ML should also be defaulted?\nDEFAULT_CONTEXT.opset_imports = {\"\": onnx.defs.onnx_opset_version()}\n\nLEXICAL_SCOPE_CONTEXT = C.LexicalScopeContext()\n\n\nFuncType = TypeVar(\"FuncType\", bound=Callable[..., Any])\n\n\ndef _ensure_proto_type(proto: Message, proto_type: type[Message]) -> None:\n    if not isinstance(proto, proto_type):\n        raise TypeError(\n            f\"The proto message needs to be of type '{proto_type.__name__}'\"\n        )\n\n\ndef check_value_info(\n    value_info: ValueInfoProto, ctx: C.CheckerContext = DEFAULT_CONTEXT\n) -> None:\n    _ensure_proto_type(value_info, ValueInfoProto)\n    return C.check_value_info(value_info.SerializeToString(), ctx)\n\n\ndef check_tensor(tensor: TensorProto, ctx: C.CheckerContext = DEFAULT_CONTEXT) -> None:\n    _ensure_proto_type(tensor, TensorProto)\n    return C.check_tensor(tensor.SerializeToString(), ctx)\n\n\ndef check_attribute(\n    attr: AttributeProto,\n    ctx: C.CheckerContext = DEFAULT_CONTEXT,\n    lex_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,\n) -> None:\n    _ensure_proto_type(attr, AttributeProto)\n    return C.check_attribute(attr.SerializeToString(), ctx, lex_ctx)\n\n\ndef check_node(\n    node: NodeProto,\n    ctx: C.CheckerContext = DEFAULT_CONTEXT,\n    lex_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,\n) -> None:\n    _ensure_proto_type(node, NodeProto)\n    return C.check_node(node.SerializeToString(), ctx, lex_ctx)\n\n\ndef check_function(\n    function: FunctionProto,\n    ctx: C.CheckerContext,\n    lex_ctx: C.LexicalScopeContext,\n) -> None:\n    _ensure_proto_type(function, FunctionProto)\n    C.check_function(function.SerializeToString(), ctx, lex_ctx)\n\n\ndef check_graph(\n    graph: GraphProto,\n    ctx: C.CheckerContext = DEFAULT_CONTEXT,\n    lex_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,\n) -> None:\n    _ensure_proto_type(graph, GraphProto)\n    return C.check_graph(graph.SerializeToString(), ctx, lex_ctx)\n\n\ndef check_sparse_tensor(\n    sparse: SparseTensorProto, ctx: C.CheckerContext = DEFAULT_CONTEXT\n) -> None:\n    _ensure_proto_type(sparse, SparseTensorProto)\n    C.check_sparse_tensor(sparse.SerializeToString(), ctx)\n\n\ndef check_model(\n    model: ModelProto | str | bytes | os.PathLike,\n    full_check: bool = False,\n    skip_opset_compatibility_check: bool = False,\n) -> None:\n    \"\"\"Check the consistency of a model.\n\n    An exception will be raised if the model's ir_version is not set\n    properly or is higher than checker's ir_version, or if the model\n    has duplicate keys in metadata_props.\n\n    If IR version >= 3, the model must specify opset_import.\n    If IR version < 3, the model cannot have any opset_import specified.\n\n    Args:\n        model: Model to check. If model is a path, the function checks model\n            path first. If the model bytes size is larger than 2GB, function\n            should be called using model path.\n        full_check: If True, the function also runs shape inference check.\n        skip_opset_compatibility_check: If True, the function skips the check for\n            opset compatibility.\n    \"\"\"\n    # If model is a path instead of ModelProto\n    if isinstance(model, (str, os.PathLike)):\n        C.check_model_path(os.fspath(model), full_check, skip_opset_compatibility_check)\n    else:\n        protobuf_string = (\n            model if isinstance(model, bytes) else model.SerializeToString()\n        )\n        # If the protobuf is larger than 2GB,\n        # remind users should use the model path to check\n        if sys.getsizeof(protobuf_string) > MAXIMUM_PROTOBUF:\n            raise ValueError(\n                \"This protobuf of onnx model is too large (>2GB). Call check_model with model path instead.\"\n            )\n        C.check_model(protobuf_string, full_check, skip_opset_compatibility_check)\n\n\nValidationError = C.ValidationError\n", "path": "onnx/checker.py"}], "after_files": [{"content": "# Copyright (c) ONNX Project Contributors\n#\n# SPDX-License-Identifier: Apache-2.0\n\"\"\"Graph utilities for checking whether an ONNX proto message is legal.\"\"\"\n\nfrom __future__ import annotations\n\n__all__ = [\n    \"check_attribute\",\n    \"check_function\",\n    \"check_graph\",\n    \"check_model\",\n    \"check_node\",\n    \"check_sparse_tensor\",\n    \"check_tensor\",\n    \"check_value_info\",\n    \"DEFAULT_CONTEXT\",\n    \"LEXICAL_SCOPE_CONTEXT\",\n    \"ValidationError\",\n    \"C\",\n    \"MAXIMUM_PROTOBUF\",\n]\n\nimport os\nimport sys\nfrom typing import Any, Callable, TypeVar\n\nfrom google.protobuf.message import Message\n\nimport onnx.defs\nimport onnx.onnx_cpp2py_export.checker as C  # noqa: N812\nimport onnx.shape_inference\nfrom onnx import (\n    IR_VERSION,\n    AttributeProto,\n    FunctionProto,\n    GraphProto,\n    ModelProto,\n    NodeProto,\n    SparseTensorProto,\n    TensorProto,\n    ValueInfoProto,\n)\n\n# Limitation of single protobuf file is 2GB\nMAXIMUM_PROTOBUF = 2000000000\n\n# TODO: This thing where we reserialize the protobuf back into the\n# string, only to deserialize it at the call site, is really goofy.\n# Stop doing that.\n\n\n# NB: Please don't edit this context!\nDEFAULT_CONTEXT = C.CheckerContext()\nDEFAULT_CONTEXT.ir_version = IR_VERSION\n# TODO: Maybe ONNX-ML should also be defaulted?\nDEFAULT_CONTEXT.opset_imports = {\"\": onnx.defs.onnx_opset_version()}\n\nLEXICAL_SCOPE_CONTEXT = C.LexicalScopeContext()\n\n\nFuncType = TypeVar(\"FuncType\", bound=Callable[..., Any])\n\n\ndef _ensure_proto_type(proto: Message, proto_type: type[Message]) -> None:\n    if not isinstance(proto, proto_type):\n        raise TypeError(\n            f\"The proto message needs to be of type '{proto_type.__name__}'\"\n        )\n\n\ndef check_value_info(\n    value_info: ValueInfoProto, ctx: C.CheckerContext = DEFAULT_CONTEXT\n) -> None:\n    _ensure_proto_type(value_info, ValueInfoProto)\n    return C.check_value_info(value_info.SerializeToString(), ctx)\n\n\ndef check_tensor(tensor: TensorProto, ctx: C.CheckerContext = DEFAULT_CONTEXT) -> None:\n    _ensure_proto_type(tensor, TensorProto)\n    return C.check_tensor(tensor.SerializeToString(), ctx)\n\n\ndef check_attribute(\n    attr: AttributeProto,\n    ctx: C.CheckerContext = DEFAULT_CONTEXT,\n    lexical_scope_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,\n) -> None:\n    _ensure_proto_type(attr, AttributeProto)\n    return C.check_attribute(attr.SerializeToString(), ctx, lexical_scope_ctx)\n\n\ndef check_node(\n    node: NodeProto,\n    ctx: C.CheckerContext = DEFAULT_CONTEXT,\n    lexical_scope_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,\n) -> None:\n    _ensure_proto_type(node, NodeProto)\n    return C.check_node(node.SerializeToString(), ctx, lexical_scope_ctx)\n\n\ndef check_function(\n    function: FunctionProto,\n    ctx: C.CheckerContext = DEFAULT_CONTEXT,\n    lexical_scope_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,\n) -> None:\n    _ensure_proto_type(function, FunctionProto)\n    C.check_function(function.SerializeToString(), ctx, lexical_scope_ctx)\n\n\ndef check_graph(\n    graph: GraphProto,\n    ctx: C.CheckerContext = DEFAULT_CONTEXT,\n    lexical_scope_ctx: C.LexicalScopeContext = LEXICAL_SCOPE_CONTEXT,\n) -> None:\n    _ensure_proto_type(graph, GraphProto)\n    return C.check_graph(graph.SerializeToString(), ctx, lexical_scope_ctx)\n\n\ndef check_sparse_tensor(\n    sparse: SparseTensorProto, ctx: C.CheckerContext = DEFAULT_CONTEXT\n) -> None:\n    _ensure_proto_type(sparse, SparseTensorProto)\n    C.check_sparse_tensor(sparse.SerializeToString(), ctx)\n\n\ndef check_model(\n    model: ModelProto | str | bytes | os.PathLike,\n    full_check: bool = False,\n    skip_opset_compatibility_check: bool = False,\n) -> None:\n    \"\"\"Check the consistency of a model.\n\n    An exception will be raised if the model's ir_version is not set\n    properly or is higher than checker's ir_version, or if the model\n    has duplicate keys in metadata_props.\n\n    If IR version >= 3, the model must specify opset_import.\n    If IR version < 3, the model cannot have any opset_import specified.\n\n    Args:\n        model: Model to check. If model is a path, the function checks model\n            path first. If the model bytes size is larger than 2GB, function\n            should be called using model path.\n        full_check: If True, the function also runs shape inference check.\n        skip_opset_compatibility_check: If True, the function skips the check for\n            opset compatibility.\n    \"\"\"\n    # If model is a path instead of ModelProto\n    if isinstance(model, (str, os.PathLike)):\n        C.check_model_path(os.fspath(model), full_check, skip_opset_compatibility_check)\n    else:\n        protobuf_string = (\n            model if isinstance(model, bytes) else model.SerializeToString()\n        )\n        # If the protobuf is larger than 2GB,\n        # remind users should use the model path to check\n        if sys.getsizeof(protobuf_string) > MAXIMUM_PROTOBUF:\n            raise ValueError(\n                \"This protobuf of onnx model is too large (>2GB). Call check_model with model path instead.\"\n            )\n        C.check_model(protobuf_string, full_check, skip_opset_compatibility_check)\n\n\nValidationError = C.ValidationError\n", "path": "onnx/checker.py"}]}