class_docstr: A simple PyTorch interface for ULM
class_docstr_tok: ["A","simple","PyTorch","interface","for","ULM"]
code: def sample_top_hypotheses(
      self,
      sentences: tp.List[str],
      beam: int = 1,
      verbose: bool = False,
      **kwargs,
  ) -> tp.List[str]:
      if isinstance(sentences, str):
          return self.sample_top_hypotheses(
              [sentences], beam=beam, verbose=verbose, **kwargs
          )[0]
      tokenized_sentences = [
          self.encode(sentence) for sentence in sentences
      ]
      batched_hypos = self.generate(
          tokenized_sentences, beam, verbose, **kwargs
      )
  
      return [
          self.post_process_predictions(src_tokens, hypos)
          for src_tokens, hypos in zip(
              tokenized_sentences, batched_hypos
          )
      ]
  
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 6 for calling the UnitLanguageModelSampler obj's underlying member method code with example usage: obj.sample_top_hypotheses(sentences, beam, verbose) and returns: unknown, self