docstr: For comparision run:
  >>> import t5  # pip install t5==0.7.1
  >>> from t5.data.sentencepiece_vocabulary import SentencePieceVocabulary
  
  >>> path_to_mtf_small_t5_checkpoint = '<fill_in>'
  >>> path_to_mtf_small_spm_model_path = '<fill_in>'
  >>> t5_model = t5.models.MtfModel(model_dir=path_to_mtf_small_t5_checkpoint, batch_size=1, tpu=None)
  >>> vocab = SentencePieceVocabulary(path_to_mtf_small_spm_model_path, extra_ids=100)
  >>> score = t5_model.score(inputs=["Hello there"], targets=["Hi I am"], vocabulary=vocab)
docstr_tok: ["For","comparision","run",":",">",">",">","import","t5","#","pip","install","t5==0.7.1",">",">",">","from","t5.data.sentencepiece_vocabulary","import","SentencePieceVocabulary",">",">",">","path_to_mtf_small_t5_checkpoint","=","'","<","fill_in",">","'",">",">",">","path_to_mtf_small_spm_model_path","=","'","<","fill_in",">","'",">",">",">","t5_model","=","t5.models.MtfModel","(","model_dir=path_to_mtf_small_t5_checkpoint",",","batch_size=1",",","tpu=None",")",">",">",">","vocab","=","SentencePieceVocabulary","(","path_to_mtf_small_spm_model_path",",","extra_ids=100",")",">",">",">","score","=","t5_model.score","(","inputs=","[","``","Hello","there","''","]",",","targets=","[","``","Hi","I","am","''","]",",","vocabulary=vocab",")"]
code: def test_small_integration_test(self):
      """
      For comparision run:
      >>> import t5  # pip install t5==0.7.1
      >>> from t5.data.sentencepiece_vocabulary import SentencePieceVocabulary
  
      >>> path_to_mtf_small_t5_checkpoint = '<fill_in>'
      >>> path_to_mtf_small_spm_model_path = '<fill_in>'
      >>> t5_model = t5.models.MtfModel(model_dir=path_to_mtf_small_t5_checkpoint, batch_size=1, tpu=None)
      >>> vocab = SentencePieceVocabulary(path_to_mtf_small_spm_model_path, extra_ids=100)
      >>> score = t5_model.score(inputs=["Hello there"], targets=["Hi I am"], vocabulary=vocab)
      """
  
      model = TFT5ForConditionalGeneration.from_pretrained("t5-small")
      tokenizer = T5Tokenizer.from_pretrained("t5-small")
  
      input_ids = tokenizer(
          "Hello there", return_tensors="tf"
      ).input_ids
      labels = tokenizer("Hi I am", return_tensors="tf").input_ids
  
      loss = model(input_ids, labels=labels).loss
      mtf_score = -tf.math.reduce_mean(loss).numpy()
  
      EXPECTED_SCORE = -4.771147
      self.assertTrue(abs(mtf_score - EXPECTED_SCORE) < 1e-4)
  
imports: from __future__ import annotations
  import unittest
  from transformers import T5Config, is_tf_available
  from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow
  from transformers.utils import cached_property
  from ...test_configuration_common import ConfigTester
  from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
  from ...test_pipeline_mixin import PipelineTesterMixin
label_desc: Use image node_id 2 for calling the TFT5ModelIntegrationTests obj's underlying member method code with example usage: obj.test_small_integration_test() without return types