class_docstr: Integration tests ensuring supported models are correctly exported
class_docstr_tok: ["Integration","tests","ensuring","supported","models","are","correctly","exported"]
code: def _onnx_export(
      self,
      test_name,
      name,
      model_name,
      feature,
      onnx_config_class_constructor,
      device="cpu",
      framework="pt",
  ):
      from transformers.onnx import export
  
      model_class = FeaturesManager.get_model_class_for_feature(
          feature, framework=framework
      )
      config = AutoConfig.from_pretrained(model_name)
      model = model_class.from_config(config)
  
      # Dynamic axes aren't supported for YOLO-like models. This means they cannot be exported to ONNX on CUDA devices.
      # See: https://github.com/ultralytics/yolov5/pull/8378
      if (
          model.__class__.__name__.startswith("Yolos")
          and device != "cpu"
      ):
          return
  
      # ONNX inference fails with the following name, feature, framework parameterizations
      # See: https://github.com/huggingface/transformers/issues/19357
      if (name, feature, framework) in {
          ("deberta-v2", "question-answering", "pt"),
          ("deberta-v2", "multiple-choice", "pt"),
          ("roformer", "multiple-choice", "pt"),
          ("groupvit", "default", "pt"),
          ("perceiver", "masked-lm", "pt"),
          ("perceiver", "sequence-classification", "pt"),
          ("perceiver", "image-classification", "pt"),
          ("bert", "multiple-choice", "tf"),
          ("camembert", "multiple-choice", "tf"),
          ("roberta", "multiple-choice", "tf"),
      }:
          return
  
      onnx_config = onnx_config_class_constructor(model.config)
  
      if is_torch_available():
          from transformers.utils import torch_version
  
          if torch_version < onnx_config.torch_onnx_minimum_version:
              pytest.skip(
                  "Skipping due to incompatible PyTorch version. Minimum required is"
                  f" {onnx_config.torch_onnx_minimum_version}, got: {torch_version}"
              )
  
      preprocessor = get_preprocessor(model_name)
  
      # Useful for causal lm models that do not use pad tokens.
      if isinstance(
          preprocessor, PreTrainedTokenizerBase
      ) and not getattr(config, "pad_token_id", None):
          config.pad_token_id = preprocessor.eos_token_id
  
      with NamedTemporaryFile("w") as output:
          try:
              onnx_inputs, onnx_outputs = export(
                  preprocessor,
                  model,
                  onnx_config,
                  onnx_config.default_onnx_opset,
                  Path(output.name),
                  device=device,
              )
              validate_model_outputs(
                  onnx_config,
                  preprocessor,
                  model,
                  Path(output.name),
                  onnx_outputs,
                  onnx_config.atol_for_validation,
              )
          except (RuntimeError, ValueError) as e:
              self.fail(f"{name}, {feature} -> {e}")
  
imports: import os
  from pathlib import Path
  from tempfile import NamedTemporaryFile
  from unittest import TestCase
  from unittest.mock import patch
  import pytest
  from parameterized import parameterized
  from transformers import AutoConfig, PreTrainedTokenizerBase, is_tf_available, is_torch_available
  from transformers.onnx import EXTERNAL_DATA_FORMAT_SIZE_LIMIT, OnnxConfig, OnnxConfigWithPast, ParameterFormat, export, validate_model_outputs
  from transformers.onnx.utils import compute_effective_axis_dimension, compute_serialized_parameters_size, get_preprocessor
  from transformers.testing_utils import require_onnx, require_rjieba, require_tf, require_torch, require_vision, slow
label_desc: Use image node_id 1 for calling the OnnxExportTestCaseV2 obj's underlying member method code with example usage: obj._onnx_export(test_name, name, model_name, feature, onnx_config_class_constructor, device, framework) without return types