class_docstr: A mixin class for all pre-trained classes to inherit.
      
class_docstr_tok: ["A","mixin","class","for","all","pre-trained","classes","to","inherit","."]
docstr: Download the specified pre-trained checkpoint, and return the
  directory in which the checkpoint is cached.
  
  Args:
      pretrained_model_name (str): Name of the model checkpoint.
      cache_dir (str, optional): Path to the cache directory. If `None`,
          uses the default directory (user's home directory).
  
  Returns:
      Path to the cache directory.
docstr_tok: ["Download","the","specified","pre-trained","checkpoint",",","and","return","the","directory","in","which","the","checkpoint","is","cached",".","Args",":","pretrained_model_name","(","str",")",":","Name","of","the","model","checkpoint",".","cache_dir","(","str",",","optional",")",":","Path","to","the","cache","directory",".","If","`","None","`",",","uses","the","default","directory","(","user","'s","home","directory",")",".","Returns",":","Path","to","the","cache","directory","."]
code: def download_checkpoint(cls, pretrained_model_name, cache_dir=None):
      r"""Download the specified pre-trained checkpoint, and return the
      directory in which the checkpoint is cached.
  
      Args:
          pretrained_model_name (str): Name of the model checkpoint.
          cache_dir (str, optional): Path to the cache directory. If `None`,
              uses the default directory (user's home directory).
  
      Returns:
          Path to the cache directory.
      """
      if pretrained_model_name in cls._MODEL2URL:
          download_path = cls._MODEL2URL[pretrained_model_name]
      else:
          raise ValueError(
              "Pre-trained model not found: {}".format(
                  pretrained_model_name
              )
          )
  
      if cache_dir is None:
          cache_path = default_download_dir(cls._MODEL_NAME)
      else:
          cache_path = Path(cache_dir)
      cache_path = cache_path / pretrained_model_name
  
      if not cache_path.exists():
          if isinstance(download_path, list):
              for path in download_path:
                  maybe_download(path, str(cache_path))
          else:
              filename = download_path.split("/")[-1]
              maybe_download(
                  download_path, str(cache_path), extract=True
              )
              folder = None
              for file in cache_path.iterdir():
                  if file.is_dir():
                      folder = file
              assert folder is not None
              (cache_path / filename).unlink()
              for file in folder.iterdir():
                  file.rename(file.parents[1] / file.name)
              folder.rmdir()
          print(
              "Pre-trained {} checkpoint {} cached to {}".format(
                  cls._MODEL_NAME, pretrained_model_name, cache_path
              )
          )
      else:
          print(
              "Using cached pre-trained {} checkpoint from {}.".format(
                  cls._MODEL_NAME, cache_path
              )
          )
  
      return str(cache_path)
  
imports: import os
  import sys
  from abc import ABCMeta, abstractmethod
  from pathlib import Path
  from texar.tf.data.data_utils import maybe_download
  from texar.tf.hyperparams import HParams
  from texar.tf.module_base import ModuleBase
label_desc: Use image node_id 7 for calling the PretrainedMixin obj's underlying member method code with example usage: obj.download_checkpoint(cls, pretrained_model_name, cache_dir) and returns: str