code: def get_pretrained_tokenizer(
      tokenizer_name: str,
      checkpoint_name: str,
      use_fast: Optional[bool] = True,
      add_prefix_space: Optional[bool] = None,
  ):
      """
      Load the tokenizer for a pre-trained huggingface checkpoint.
  
      Parameters
      ----------
      tokenizer_name
          The tokenizer type, e.g., "bert", "clip", "electra", and "hf_auto".
      checkpoint_name
          Name of a pre-trained checkpoint.
      use_fast
          Use a fast Rust-based tokenizer if it is supported for a given model.
          If a fast tokenizer is not available for a given model, a normal Python-based tokenizer is returned instead.
          See: https://huggingface.co/docs/transformers/model_doc/auto#transformers.AutoTokenizer.from_pretrained.use_fast
  
      Returns
      -------
      A tokenizer instance.
      """
      try:
          tokenizer_class = ALL_TOKENIZERS[tokenizer_name]
          if add_prefix_space is None:
              return tokenizer_class.from_pretrained(
                  checkpoint_name, use_fast=use_fast
              )
          else:
              return tokenizer_class.from_pretrained(
                  checkpoint_name,
                  use_fast=use_fast,
                  add_prefix_space=add_prefix_space,
              )
      except TypeError as e:
          try:
              tokenizer = BertTokenizer.from_pretrained(checkpoint_name)
              warnings.warn(
                  f"Current checkpoint {checkpoint_name} does not support AutoTokenizer. "
                  "Switch to BertTokenizer instead.",
                  UserWarning,
              )
              return tokenizer
          except:
              raise e
  
imports: import logging
  import re
  import warnings
  from typing import Dict, List, Optional, Tuple
  import torch
  import torch._dynamo
  import torch.nn.functional
  from torch import nn
  from torch.nn.modules.loss import _Loss
  from transformers import AutoConfig, AutoModel, AutoTokenizer, BertTokenizer, CLIPTokenizer, ElectraTokenizer
  from transformers.models.mask2former.modeling_mask2former import Mask2FormerLoss
  from ..constants import AUTOMM, CLASS_LOGITS, COLUMN_FEATURES, FEATURES, LOGITS, MASKS, OCR, PEFT_ADDITIVE_STRATEGIES, REGRESSION, SEMANTIC_MASK, SEMANTIC_SEGMENTATION
  from .adaptation_layers import IA3Linear, IA3LoRALinear, LoRALinear
label_desc: Use image node_id 21 for calling a global function with example usage: get_pretrained_tokenizer(tokenizer_name, checkpoint_name, use_fast, add_prefix_space) and returns: tokenizer_class, tokenizer_class, tokenizer