code: def _create_data_with_sp_transform(sp_generator, data_path):
      data = []
      labels = []
      with io.open(data_path, encoding="utf8") as f:
          reader = unicode_csv_reader(f)
          for row in reader:
              corpus = " ".join(row[1:])
              token_ids = list(sp_generator([corpus]))[0]
              label = int(row[0]) - 1
              data.append((label, torch.tensor(token_ids)))
              labels.append(label)
      return data, set(labels)
  
file_path: serve/examples/text_classification/spm_dataset.py
imports: import logging
  import torch
  import io
  from torchtext.utils import download_from_url, extract_archive, unicode_csv_reader
  from os import path
  from torchtext.datasets.text_classification import URLS
  from torchtext.data.functional import generate_sp_model, load_sp_model, sentencepiece_numericalizer
  from torchtext.datasets import text_classification
label_desc: Use image node_id 1 for calling a global function with example usage: _create_data_with_sp_transform(sp_generator, data_path) and returns: data,  set