code: def test_resize_embeddings(self):
      model = TFMT5ForConditionalGeneration.from_pretrained(
          "google/mt5-small"
      )
      original_vocab_size = model.get_input_embeddings().weight.shape[0]
      # the vocab size is defined in the model config
      self.assertEqual(original_vocab_size, model.config.vocab_size)
  
      tokenizer = T5Tokenizer.from_pretrained("google/mt5-small")
      tokenizer.add_special_tokens({"bos_token": "", "eos_token": ""})
      model._resize_token_embeddings(len(tokenizer))
      # the vocab size is now resized to the length of the tokenizer, which is different from the original size
      self.assertEqual(
          model.get_input_embeddings().weight.shape[0], len(tokenizer)
      )
      self.assertNotEqual(
          model.get_input_embeddings().weight.shape[0],
          original_vocab_size,
      )
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/tests/models/mt5/test_modeling_tf_mt5.py
imports: import unittest
  from transformers import is_tf_available
  from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow
label_desc: Use image node_id 1 for calling the TFMT5ModelTest obj's underlying member method code with example usage: obj.test_resize_embeddings() without return types