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_encoder_decoder_models(
      self,
      test_name,
      name,
      model_name,
      feature,
      onnx_config_class_constructor,
      device="cpu",
  ):
      from transformers import AutoFeatureExtractor, AutoTokenizer
      from transformers.onnx import export
  
      model_class = FeaturesManager.get_model_class_for_feature(feature)
      config = AutoConfig.from_pretrained(model_name)
      model = model_class.from_config(config)
  
      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}"
              )
  
      encoder_model = model.get_encoder()
      decoder_model = model.get_decoder()
  
      encoder_onnx_config = onnx_config.get_encoder_config(
          encoder_model.config
      )
      decoder_onnx_config = onnx_config.get_decoder_config(
          encoder_model.config, decoder_model.config, feature
      )
  
      preprocessor = AutoFeatureExtractor.from_pretrained(model_name)
  
      onnx_opset = max(
          encoder_onnx_config.default_onnx_opset,
          decoder_onnx_config.default_onnx_opset,
      )
  
      with NamedTemporaryFile("w") as encoder_output:
          onnx_inputs, onnx_outputs = export(
              preprocessor,
              encoder_model,
              encoder_onnx_config,
              onnx_opset,
              Path(encoder_output.name),
              device=device,
          )
          validate_model_outputs(
              encoder_onnx_config,
              preprocessor,
              encoder_model,
              Path(encoder_output.name),
              onnx_outputs,
              encoder_onnx_config.atol_for_validation,
          )
  
      preprocessor = AutoTokenizer.from_pretrained(model_name)
  
      with NamedTemporaryFile("w") as decoder_output:
          _, onnx_outputs = export(
              preprocessor,
              decoder_model,
              decoder_onnx_config,
              onnx_config.default_onnx_opset,
              Path(decoder_output.name),
              device=device,
          )
          validate_model_outputs(
              decoder_onnx_config,
              preprocessor,
              decoder_model,
              Path(decoder_output.name),
              onnx_outputs,
              decoder_onnx_config.atol_for_validation,
          )
  
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 2 for calling the OnnxExportTestCaseV2 obj's underlying member method code with example usage: obj._onnx_export_encoder_decoder_models(test_name, name, model_name, feature, onnx_config_class_constructor, device) without return types