class_docstr: Construct a CLIP tokenizer. Based on byte-level Byte-Pair-Encoding.
  
  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.
      errors (`str`, *optional*, defaults to `"replace"`):
          Paradigm to follow when decoding bytes to UTF-8. See
          [bytes.decode](https://docs.python.org/3/library/stdtypes.html#bytes.decode) for more information.
      unk_token (`str`, *optional*, defaults to `"<|endoftext|>"`):
          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.
      bos_token (`str`, *optional*, defaults to `"<|startoftext|>"`):
          The beginning of sequence token.
      eos_token (`str`, *optional*, defaults to `"<|endoftext|>"`):
          The end of sequence token.
      pad_token (`str`, *optional*, defaults to `"<|endoftext|>"`):
          The token used for padding, for example when batching sequences of different lengths.
class_docstr_tok: ["Construct","a","CLIP","tokenizer",".","Based","on","byte-level","Byte-Pair-Encoding",".","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",".","errors","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","replace","''","`",")",":","Paradigm","to","follow","when","decoding","bytes","to","UTF-8",".","See","[","bytes.decode","]","(","https",":","\/\/docs.python.org\/3\/library\/stdtypes.html","#","bytes.decode",")","for","more","information",".","unk_token","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","<","|endoftext|",">","''","`",")",":","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",".","bos_token","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","<","|startoftext|",">","''","`",")",":","The","beginning","of","sequence","token",".","eos_token","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","<","|endoftext|",">","''","`",")",":","The","end","of","sequence","token",".","pad_token","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","<","|endoftext|",">","''","`",")",":","The","token","used","for","padding",",","for","example","when","batching","sequences","of","different","lengths","."]
code: def save_vocabulary(
      self, save_directory: str, filename_prefix: Optional[str] = None
  ) -> Tuple[str]:
      if not os.path.isdir(save_directory):
          logger.error(
              "Vocabulary path ({}) should be a directory".format(
                  save_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(
                      "Saving vocabulary to {}: BPE merge indices are not consecutive."
                      " Please check that the tokenizer is not corrupted!".format(
                          merge_file
                      )
                  )
                  index = token_index
              writer.write(" ".join(bpe_tokens) + "\n")
              index += 1
  
      return vocab_file, merge_file
  
imports: import json
  import os
  import unicodedata
  from functools import lru_cache
  from typing import List, Optional, Tuple
  import regex
  from ...tokenization_utils import AddedToken, PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
  from ...utils import logging
label_desc: Use image node_id 12 for calling the CLIPTokenizer obj's underlying member method code with example usage: obj.save_vocabulary(save_directory, filename_prefix) and returns: vocab_file,  merge_file