code: def test_pyonmttok_sp(self):
      onmttok_cls = get_transforms_cls(["onmt_tokenize"])[
          "onmt_tokenize"
      ]
      base_opt = copy.copy(self.base_opts)
      base_opt["src_subword_type"] = "sentencepiece"
      base_opt["tgt_subword_type"] = "sentencepiece"
      base_opt["src_subword_model"] = "data/sample.sp.model"
      base_opt["tgt_subword_model"] = "data/sample.sp.model"
      onmt_args = "{'mode': 'none', 'spacer_annotate': True}"
      base_opt["src_onmttok_kwargs"] = onmt_args
      base_opt["tgt_onmttok_kwargs"] = onmt_args
      base_opt["gpt2_pretok"] = False
      opt = Namespace(**base_opt)
      onmttok_cls._validate_options(opt)
      onmttok_transform = onmttok_cls(opt)
      onmttok_transform.warm_up()
      ex = {
          "src": ["Hello", "world", "."],
          "tgt": ["Bonjour", "le", "monde", "."],
      }
      onmttok_transform.apply(ex, is_train=True)
      ex_gold = {
          "src": ["▁H", "el", "lo", "▁world", "▁."],
          "tgt": [
              "▁B",
              "on",
              "j",
              "o",
              "ur",
              "▁le",
              "▁m",
              "on",
              "de",
              "▁.",
          ],
      }
      self.assertEqual(ex, ex_gold)
  
      # Test mask location
      ex = {
          "src": (
              "### Instruction: ｟newline｠instruction｟newline｠｟newline｠"
              "### Response : ｟newline｠｟_mask_before_｠response"
          ),
          "tgt": "",
      }
      ex["src"] = ex["src"].split(" ")
      onmttok_transform.apply(ex, is_train=True)
      ex_gold = {
          "src": [
              "▁",
              "#",
              "#",
              "#",
              "▁In",
              "struct",
              "ion",
              ":",
              "▁in",
              "struct",
              "ion",
              "▁",
              "#",
              "#",
              "#",
              "▁Re",
              "s",
              "p",
              "on",
              "se",
              "▁",
              ":",
              "<blank>",
              "▁re",
              "s",
              "p",
              "on",
              "se",
          ],
          "tgt": [],
      }
      self.assertEqual(ex, ex_gold)
  
imports: import unittest
  import copy
  import yaml
  import math
  from argparse import Namespace
  from onmt.transforms import get_transforms_cls, get_specials, make_transforms, TransformPipe
  from onmt.transforms.bart import BARTNoising
label_desc: Use image node_id 5 for calling the TestSubwordTransform obj's underlying member method code with example usage: obj.test_pyonmttok_sp() without return types