class_docstr: Wrapper class for Hugging Face Transformers PyTorch T5 model.
class_docstr_tok: ["Wrapper","class","for","Hugging","Face","Transformers","PyTorch","T5","model","."]
docstr: Trains model after loading from any existing checkpoint.
  
  Note that if you have initialized the model using a pre-trained model
  specification (e.g. by passing "t5-base" for `model_spec`) then you can
  just call `train` directly. This function is only provided for convenience
  for loading a pre-trained model checkpoint from an arbitrary model
  directory before calling `train`.
  
  Args:
    mixture_or_task_name: str, the name of the Mixture or Task to evaluate
      on.  Must be pre-registered in the global `t5.data.TaskRegistry` or
      `t5.data.MixtureRegistry.`
    finetune_steps: int, the number of additional steps to train for.
    pretrained_model_dir: str, directory with pretrained model checkpoints.
    pretrained_checkpoint_step: int, checkpoint to initialize weights from.
      If -1 (default), use the latest checkpoint from the pretrained model
      directory.
    **train_kwargs: Additional keyword arguments to pass to `train`. See the
      docstring for `train` for more details.
docstr_tok: ["Trains","model","after","loading","from","any","existing","checkpoint",".","Note","that","if","you","have","initialized","the","model","using","a","pre-trained","model","specification","(","e.g",".","by","passing","``","t5-base","''","for","`","model_spec","`",")","then","you","can","just","call","`","train","`","directly",".","This","function","is","only","provided","for","convenience","for","loading","a","pre-trained","model","checkpoint","from","an","arbitrary","model","directory","before","calling","`","train","`",".","Args",":","mixture_or_task_name",":","str",",","the","name","of","the","Mixture","or","Task","to","evaluate","on",".","Must","be","pre-registered","in","the","global","`","t5.data.TaskRegistry","`","or","`","t5.data.MixtureRegistry.","`","finetune_steps",":","int",",","the","number","of","additional","steps","to","train","for",".","pretrained_model_dir",":","str",",","directory","with","pretrained","model","checkpoints",".","pretrained_checkpoint_step",":","int",",","checkpoint","to","initialize","weights","from",".","If","-1","(","default",")",",","use","the","latest","checkpoint","from","the","pretrained","model","directory",".","*","*","train_kwargs",":","Additional","keyword","arguments","to","pass","to","`","train","`",".","See","the","docstring","for","`","train","`","for","more","details","."]
code: def finetune(
      self,
      mixture_or_task_name,
      finetune_steps,
      pretrained_model_dir,
      pretrained_checkpoint_step=-1,
      **train_kwargs,
  ):
      """Trains model after loading from any existing checkpoint.
  
      Note that if you have initialized the model using a pre-trained model
      specification (e.g. by passing "t5-base" for `model_spec`) then you can
      just call `train` directly. This function is only provided for convenience
      for loading a pre-trained model checkpoint from an arbitrary model
      directory before calling `train`.
  
      Args:
        mixture_or_task_name: str, the name of the Mixture or Task to evaluate
          on.  Must be pre-registered in the global `t5.data.TaskRegistry` or
          `t5.data.MixtureRegistry.`
        finetune_steps: int, the number of additional steps to train for.
        pretrained_model_dir: str, directory with pretrained model checkpoints.
        pretrained_checkpoint_step: int, checkpoint to initialize weights from.
          If -1 (default), use the latest checkpoint from the pretrained model
          directory.
        **train_kwargs: Additional keyword arguments to pass to `train`. See the
          docstring for `train` for more details.
      """
      if pretrained_checkpoint_step == -1:
          pretrained_checkpoint_step = self.get_latest_checkpoint_step(
              pretrained_model_dir
          )
      self.load_checkpoint(
          pretrained_checkpoint_step, pretrained_model_dir
      )
      self.train(mixture_or_task_name, finetune_steps, **train_kwargs)
  
imports: import functools
  import itertools
  import os
  import re
  import time
  from absl import logging
  import mesh_tensorflow.transformer.dataset
  import seqio
  import t5.data
  from t5.models import utils
  from t5.models.t5_model import T5Model
  import tensorflow.compat.v1
  import tensorflow_datasets
  import torch
  import torch.utils.tensorboard
label_desc: Use image node_id 12 for calling the HfPyTorchModel obj's underlying member method code with example usage: obj.finetune(mixture_or_task_name, finetune_steps, pretrained_model_dir, pretrained_checkpoint_step) without return types