code: def test_finetune_extra_model_args(self):
      args_d: dict = CHEAP_ARGS.copy()
  
      task = "summarization"
      tmp_dir = make_test_data_dir(
          tmp_dir=self.get_auto_remove_tmp_dir()
      )
  
      args_d.update(
          data_dir=tmp_dir,
          tokenizer_name=None,
          train_batch_size=2,
          eval_batch_size=2,
          do_predict=False,
          task=task,
          src_lang="en_XX",
          tgt_lang="ro_RO",
          freeze_encoder=True,
          freeze_embeds=True,
      )
  
      # test models whose config includes the extra_model_args
      model = BART_TINY
      output_dir = self.get_auto_remove_tmp_dir()
      args_d1 = args_d.copy()
      args_d1.update(
          model_name_or_path=model,
          output_dir=output_dir,
      )
      extra_model_params = (
          "encoder_layerdrop",
          "decoder_layerdrop",
          "dropout",
          "attention_dropout",
      )
      for p in extra_model_params:
          args_d1[p] = 0.5
      args = argparse.Namespace(**args_d1)
      model = main(args)
      for p in extra_model_params:
          assert (
              getattr(model.config, p) == 0.5
          ), f"failed to override the model config for param {p}"
  
      # test models whose config doesn't include the extra_model_args
      model = T5_TINY
      output_dir = self.get_auto_remove_tmp_dir()
      args_d2 = args_d.copy()
      args_d2.update(
          model_name_or_path=model,
          output_dir=output_dir,
      )
      unsupported_param = "encoder_layerdrop"
      args_d2[unsupported_param] = 0.5
      args = argparse.Namespace(**args_d2)
      with pytest.raises(Exception) as excinfo:
          model = main(args)
      assert (
          str(excinfo.value)
          == f"model config doesn't have a `{unsupported_param}` attribute"
      )
  
imports: import argparse
  import logging
  import os
  import sys
  import tempfile
  from pathlib import Path
  import lightning_base
  import pytest
  import pytorch_lightning
  import torch
  from convert_pl_checkpoint_to_hf import convert_pl_to_hf
  from distillation import distill_main
  from finetune import SummarizationModule, main
  from huggingface_hub import list_models
  from parameterized import parameterized
  from run_eval import generate_summaries_or_translations
  from torch import nn
  from transformers import AutoConfig, AutoModelForSeq2SeqLM
  from transformers.testing_utils import CaptureStderr, CaptureStdout, TestCasePlus, require_torch_gpu, slow
  from utils import label_smoothed_nll_loss, lmap, load_json
label_desc: Use image node_id 2 for calling the TestTheRest obj's underlying member method code with example usage: obj.test_finetune_extra_model_args() without return types