class_docstr: SentencePiece subword transform class.
docstr: Load subword models.
docstr_tok: ["Load","subword","models","."]
code: def warm_up(self, vocabs=None):
      """Load subword models."""
      super().warm_up(None)
      import sentencepiece as spm
  
      load_src_model = spm.SentencePieceProcessor()
      load_src_model.Load(self.src_subword_model)
      _diff_vocab = (
          self.src_subword_vocab != self.tgt_subword_vocab
          or self.src_vocab_threshold != self.tgt_vocab_threshold
      )
      if self.src_subword_vocab != "" and self.src_vocab_threshold > 0:
          load_src_model.LoadVocabulary(
              self.src_subword_vocab, self.src_vocab_threshold
          )
      if self.share_vocab and not _diff_vocab:
          self.load_models = {
              "src": load_src_model,
              "tgt": load_src_model,
          }
      else:
          load_tgt_model = spm.SentencePieceProcessor()
          load_tgt_model.Load(self.tgt_subword_model)
          if (
              self.tgt_subword_vocab != ""
              and self.tgt_vocab_threshold > 0
          ):
              load_tgt_model.LoadVocabulary(
                  self.tgt_subword_vocab, self.tgt_vocab_threshold
              )
          self.load_models = {
              "src": load_src_model,
              "tgt": load_tgt_model,
          }
  
imports: import re
  from onmt.utils.logging import logger
  from onmt.transforms import register_transform
  from .transform import Transform, ObservableStats
  from onmt.constants import DefaultTokens
label_desc: Use image node_id 3 for calling the SentencePieceTransform obj's underlying member method code with example usage: obj.warm_up(vocabs) without return types