class_docstr: Sentencepiecetokenizer https://github.com/google/sentencepiece.
  
      Args:
      model_path: path to sentence piece tokenizer model. To create the model use create_spt_model()
      special_tokens: either list of special tokens or dictionary of token name to token value
      legacy: when set to True, the previous behavior of the SentecePiece wrapper will be restored,
          including the possibility to add special tokens inside wrapper.
class_docstr_tok: ["Sentencepiecetokenizer","https",":","\/\/github.com\/google\/sentencepiece",".","Args",":","model_path",":","path","to","sentence","piece","tokenizer","model",".","To","create","the","model","use","create_spt_model","(",")","special_tokens",":","either","list","of","special","tokens","or","dictionary","of","token","name","to","token","value","legacy",":","when","set","to","True",",","the","previous","behavior","of","the","SentecePiece","wrapper","will","be","restored",",","including","the","possibility","to","add","special","tokens","inside","wrapper","."]
code: def tokens_to_ids(
      self, tokens: Union[str, List[str]]
  ) -> Union[int, List[int]]:
      if isinstance(tokens, str):
          tokens = [tokens]
      ids = []
      for token in tokens:
          ids.append(self.token_to_id(token))
      return ids
  
imports: import os
  from typing import Dict, List, Optional, Union
  import numpy
  import sentencepiece
  from nemo.collections.common.parts.utils import if_exist
  from nemo.collections.common.tokenizers.tokenizer_spec import TokenizerSpec
  from nemo.utils import logging
label_desc: Use image node_id 8 for calling the SentencePieceTokenizer obj's underlying member method code with example usage: obj.tokens_to_ids(tokens) and returns: ids