class_docstr: SentencePiece tokenizer for `lang`
class_docstr_tok: ["SentencePiece","tokenizer","for","`","lang","`"]
code: def __init__(
      self,
      lang="en",
      special_toks=None,
      sp_model=None,
      vocab_sz=None,
      max_vocab_sz=30000,
      model_type="unigram",
      char_coverage=None,
      cache_dir="tmp",
  ):
      try:
          from sentencepiece import (
              SentencePieceTrainer,
              SentencePieceProcessor,
          )
      except ImportError:
          raise Exception(
              "sentencepiece module is missing: run `pip install sentencepiece!=0.1.90,!=0.1.91`"
          )
      self.sp_model, self.cache_dir = sp_model, Path(cache_dir)
      self.vocab_sz, self.max_vocab_sz, self.model_type = (
          vocab_sz,
          max_vocab_sz,
          model_type,
      )
      self.char_coverage = ifnone(
          char_coverage, 0.99999 if lang in eu_langs else 0.9998
      )
      self.special_toks = ifnone(special_toks, defaults.text_spec_tok)
      if sp_model is None:
          self.tok = None
      else:
          self.tok = SentencePieceProcessor()
          self.tok.Load(str(sp_model))
      os.makedirs(self.cache_dir, exist_ok=True)
  
imports: from __future__ import annotations
  from ..torch_basics import *
  from ..data.all import *
  import html
label_desc: Use image node_id 1 to create a new SentencePieceTokenizer object  with example: obj = SentencePieceTokenizer(lang, special_toks, sp_model, vocab_sz, max_vocab_sz, model_type, char_coverage, cache_dir)