class_docstr: Base class for all fast tokenizers (wrapping HuggingFace tokenizers library).
  
  Inherits from [`~tokenization_utils_base.PreTrainedTokenizerBase`].
  
  Handles all the shared methods for tokenization and special tokens, as well as methods for
  downloading/caching/loading pretrained tokenizers, as well as adding tokens to the vocabulary.
  
  This class also contains the added tokens in a unified way on top of all tokenizers so we don't have to handle the
  specific vocabulary augmentation methods of the various underlying dictionary structures (BPE, sentencepiece...).
class_docstr_tok: ["Base","class","for","all","fast","tokenizers","(","wrapping","HuggingFace","tokenizers","library",")",".","Inherits","from","[","`","~tokenization_utils_base.PreTrainedTokenizerBase","`","]",".","Handles","all","the","shared","methods","for","tokenization","and","special","tokens",",","as","well","as","methods","for","downloading\/caching\/loading","pretrained","tokenizers",",","as","well","as","adding","tokens","to","the","vocabulary",".","This","class","also","contains","the","added","tokens","in","a","unified","way","on","top","of","all","tokenizers","so","we","do","n't","have","to","handle","the","specific","vocabulary","augmentation","methods","of","the","various","underlying","dictionary","structures","(","BPE",",","sentencepiece","...",")","."]
docstr: Save a tokenizer using the slow-tokenizer/legacy format: vocabulary + added tokens as well as in a unique JSON
  file containing {config + vocab + added-tokens}.
docstr_tok: ["Save","a","tokenizer","using","the","slow-tokenizer\/legacy","format",":","vocabulary","+","added","tokens","as","well","as","in","a","unique","JSON","file","containing","{","config","+","vocab","+","added-tokens","}","."]
code: def _save_pretrained(
      self,
      save_directory: Union[str, os.PathLike],
      file_names: Tuple[str],
      legacy_format: Optional[bool] = None,
      filename_prefix: Optional[str] = None,
  ) -> Tuple[str]:
      """
      Save a tokenizer using the slow-tokenizer/legacy format: vocabulary + added tokens as well as in a unique JSON
      file containing {config + vocab + added-tokens}.
      """
      save_directory = str(save_directory)
  
      if self.slow_tokenizer_class is None and legacy_format is True:
          raise ValueError(
              "Your tokenizer does not have a legacy version defined and therefore cannot register this version. You"
              " might consider leaving the legacy_format at `None` or setting it to `False`."
          )
  
      save_slow = (
          (legacy_format is None or legacy_format is True)
          and self.slow_tokenizer_class is not None
          and self.can_save_slow_tokenizer
      )
      save_fast = legacy_format is None or legacy_format is False
  
      if save_slow:
          added_tokens_file = os.path.join(
              save_directory,
              (filename_prefix + "-" if filename_prefix else "")
              + ADDED_TOKENS_FILE,
          )
          added_vocab = self.get_added_vocab()
          if added_vocab:
              with open(added_tokens_file, "w", encoding="utf-8") as f:
                  out_str = (
                      json.dumps(
                          added_vocab,
                          indent=2,
                          sort_keys=True,
                          ensure_ascii=False,
                      )
                      + "\n"
                  )
                  f.write(out_str)
  
          vocab_files = self.save_vocabulary(
              save_directory, filename_prefix=filename_prefix
          )
          file_names = file_names + vocab_files + (added_tokens_file,)
  
      if save_fast:
          tokenizer_file = os.path.join(
              save_directory,
              (filename_prefix + "-" if filename_prefix else "")
              + TOKENIZER_FILE,
          )
          self.backend_tokenizer.save(tokenizer_file)
          file_names = file_names + (tokenizer_file,)
  
      return file_names
  
imports: import copy
  import json
  import os
  from collections import defaultdict
  from typing import Any, Dict, List, Optional, Tuple, Union
  import tokenizers.pre_tokenizers
  from tokenizers import Encoding
  from tokenizers import Tokenizer
  from tokenizers.decoders import Decoder
  from tokenizers.trainers import BpeTrainer, UnigramTrainer, WordLevelTrainer, WordPieceTrainer
  from .convert_slow_tokenizer import convert_slow_tokenizer
  from .tokenization_utils import PreTrainedTokenizer
  from .tokenization_utils_base import INIT_TOKENIZER_DOCSTRING, AddedToken, BatchEncoding, PreTokenizedInput, PreTokenizedInputPair, PreTrainedTokenizerBase, SpecialTokensMixin, TextInput, TextInputPair, TruncationStrategy
  from .utils import PaddingStrategy, add_end_docstrings, logging
label_desc: Use image node_id 23 for calling the PreTrainedTokenizerFast obj's underlying member method code with example usage: obj._save_pretrained(save_directory, file_names, legacy_format, filename_prefix) and returns: file_names