class_docstr: Extractor implementation for YouTokenToMe trained models format.
  Model are as follow:
      vocab_size nb_merges
      piece piece_id
      ...(repeated vocab_size)
      piece_id_left piece_id_right piece_id
      ...(repeated nb merges)
class_docstr_tok: ["Extractor","implementation","for","YouTokenToMe","trained","models","format",".","Model","are","as","follow",":","vocab_size","nb_merges","piece","piece_id","...","(","repeated","vocab_size",")","piece_id_left","piece_id_right","piece_id","...","(","repeated","nb","merges",")"]
code: def extract(self) -> Tuple[Dict[str, int], List[Tuple]]:
      with open(self._model, "r") as model_f:
          # Retrieve information
          nb_pieces, nb_merges = map(int, model_f.readline().split())
          vocab, merges = {}, []
  
          # Vocab
          for _ in trange(nb_pieces):
              piece, piece_id = map(int, model_f.readline().split())
              vocab[piece_id] = chr(piece)
  
          # Merges
          for _ in trange(nb_merges):
              piece_id_l, piece_id_r, piece = map(
                  int, model_f.readline().split()
              )
              piece_l, piece_r = vocab[piece_id_l], vocab[piece_id_r]
              vocab[piece] = f"{piece_l}{piece_r}"
              merges += [(piece_l, piece_r)]
  
          # Special tokens
          unk, pad, bos, eos = map(int, model_f.readline().split())
          vocab[unk] = "<unk>"
          vocab[pad] = "<pad>"
          vocab[bos] = "<bos>"
          vocab[eos] = "<eos>"
  
      # Invert key and value for vocab
      vocab = dict(zip(vocab.values(), vocab.keys()))
      return vocab, merges
  
file_path: hf-tokenizers/bindings/python/scripts/sentencepiece_extractor.py
imports: from argparse import ArgumentParser
  from json import dump
  from logging import basicConfig, getLogger
  from os import linesep, remove
  from os.path import exists
  from tempfile import NamedTemporaryFile
  from typing import Dict, List, Tuple
  from requests import get
  from sentencepiece import SentencePieceProcessor
  from tqdm import trange, tqdm
label_desc: Use image node_id 2 for calling the YouTokenToMeExtractor obj's underlying member method code with example usage: obj.extract() and returns: vocab,  merges