class_docstr: Construct a GPT Tokenizer. Based on Byte-Pair-Encoding with the following peculiarities:
  
  - lowercases all inputs,
  - uses `SpaCy` tokenizer and `ftfy` for pre-BPE tokenization if they are installed, fallback to BERT's
    `BasicTokenizer` if not.
  
  This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
  this superclass for more information regarding those methods.
  
  Args:
      vocab_file (`str`):
          Path to the vocabulary file.
      merges_file (`str`):
          Path to the merges file.
      unk_token (`str`, *optional*, defaults to `"<unk>"`):
          The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
          token instead.
class_docstr_tok: ["Construct","a","GPT","Tokenizer",".","Based","on","Byte-Pair-Encoding","with","the","following","peculiarities",":","-","lowercases","all","inputs",",","-","uses","`","SpaCy","`","tokenizer","and","`","ftfy","`","for","pre-BPE","tokenization","if","they","are","installed",",","fallback","to","BERT's","`","BasicTokenizer","`","if","not",".","This","tokenizer","inherits","from","[","`","PreTrainedTokenizer","`","]","which","contains","most","of","the","main","methods",".","Users","should","refer","to","this","superclass","for","more","information","regarding","those","methods",".","Args",":","vocab_file","(","`","str","`",")",":","Path","to","the","vocabulary","file",".","merges_file","(","`","str","`",")",":","Path","to","the","merges","file",".","unk_token","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","<","unk",">","''","`",")",":","The","unknown","token",".","A","token","that","is","not","in","the","vocabulary","can","not","be","converted","to","an","ID","and","is","set","to","be","this","token","instead","."]
code: def save_vocabulary(
      self, save_directory: str, filename_prefix: Optional[str] = None
  ) -> Tuple[str]:
      if not os.path.isdir(save_directory):
          logger.error(
              f"Vocabulary path ({save_directory}) should be a directory"
          )
          return
      vocab_file = os.path.join(
          save_directory,
          (filename_prefix + "-" if filename_prefix else "")
          + VOCAB_FILES_NAMES["vocab_file"],
      )
      merge_file = os.path.join(
          save_directory,
          (filename_prefix + "-" if filename_prefix else "")
          + VOCAB_FILES_NAMES["merges_file"],
      )
  
      with open(vocab_file, "w", encoding="utf-8") as f:
          f.write(
              json.dumps(
                  self.encoder,
                  indent=2,
                  sort_keys=True,
                  ensure_ascii=False,
              )
              + "\n"
          )
  
      index = 0
      with open(merge_file, "w", encoding="utf-8") as writer:
          writer.write("#version: 0.2\n")
          for bpe_tokens, token_index in sorted(
              self.bpe_ranks.items(), key=lambda kv: kv[1]
          ):
              if index != token_index:
                  logger.warning(
                      f"Saving vocabulary to {merge_file}: BPE merge indices are not consecutive."
                      " Please check that the tokenizer is not corrupted!"
                  )
                  index = token_index
              writer.write(" ".join(bpe_tokens) + "\n")
              index += 1
  
      return vocab_file, merge_file
  
imports: import json
  import os
  import re
  import unicodedata
  from typing import Optional, Tuple
  from ...tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
  from ...utils import logging
label_desc: Use image node_id 10 for calling the OpenAIGPTTokenizer obj's underlying member method code with example usage: obj.save_vocabulary(save_directory, filename_prefix) and returns: vocab_file,  merge_file