docstr: Test if the converted model raises an error when calling `save_pretrained`
  but not when the model is reverted
docstr_tok: ["Test","if","the","converted","model","raises","an","error","when","calling","`","save_pretrained","`","but","not","when","the","model","is","reverted"]
code: def test_raise_save_pretrained_error(
      self, test_name: str, model_type: str, keep_original_model: bool
  ):
      r"""
      Test if the converted model raises an error when calling `save_pretrained`
      but not when the model is reverted
      """
  
      if (
          model_type in ["wav2vec2", "hubert", "bark"]
          and keep_original_model is True
      ):
          self.skipTest("These architectures do not support deepcopy")
  
      model_ids = (
          MODELS_DICT[model_type]
          if isinstance(MODELS_DICT[model_type], tuple)
          else (MODELS_DICT[model_type],)
      )
      for model_id in model_ids:
          # get hf and bt model
          hf_model = AutoModel.from_pretrained(model_id)
          # get bt model and invert it
          bt_model = BetterTransformer.transform(
              hf_model, keep_original_model=keep_original_model
          )
  
          with self.assertRaises(
              ValueError
          ), tempfile.TemporaryDirectory() as tmpdirname:
              bt_model.save_pretrained(tmpdirname)
  
          model = BetterTransformer.reverse(bt_model)
          with tempfile.TemporaryDirectory() as tmpdirname:
              model.save_pretrained(tmpdirname)
  
file_path: optimum/tests/bettertransformer/test_common.py
imports: import tempfile
  import unittest
  from unittest.mock import patch
  import transformers
  from parameterized import parameterized
  from testing_utils import MODELS_DICT
  from transformers import AutoModel
  from optimum.bettertransformer import BetterTransformer, BetterTransformerManager
  from optimum.pipelines import pipeline
  from optimum.utils.testing_utils import grid_parameters
label_desc: Use image node_id 5 for calling the BetterTransformerIntegrationTests obj's underlying member method code with example usage: obj.test_raise_save_pretrained_error(test_name, model_type, keep_original_model) without return types