class_docstr: A simple PyTorch interface for ULM
class_docstr_tok: ["A","simple","PyTorch","interface","for","ULM"]
code: def encode(self, unit_str):
      tokens = self.task.source_dictionary.encode_line(
          unit_str, add_if_not_exist=False
      ).long()
      return tokens
  
file_path: textlesslib/examples/gslm/sampler.py
imports: import typing
  from fairseq import hub_utils, utils
  from fairseq.hub_utils import GeneratorHubInterface
label_desc: Use image node_id 2 for calling the UnitLanguageModelSampler obj's underlying member method code with example usage: obj.encode(unit_str) and returns: tokens