class_docstr: Pytorch Hub interface for generating sequences from a pre-trained
  multichannel language model.
class_docstr_tok: ["Pytorch","Hub","interface","for","generating","sequences","from","a","pre-trained","multichannel","language","model","."]
code: def encode(
      self, sentence: Dict[str, str]
  ) -> Dict[str, torch.LongTensor]:
      assert isinstance(
          sentence, dict
      ), "Input sentence is expected to be a dictionary over channels"
      assert set(sentence.keys()) == set(
          self.channels
      ), "Mismatch between input sentence keys and model channels ({} vs {})".format(
          set(sentence.keys()), set(self.channels)
      )
      encoded_sentence = {}
      for channel in sentence:
          sentence_channel = sentence[channel]
          sentence_channel = self.tokenize(sentence_channel)
          sentence_channel = self.apply_bpe(sentence_channel)
          sentence_channel = self.binarize(sentence_channel, channel)
          encoded_sentence[channel] = sentence_channel
      sentence_size = encoded_sentence[self.channels[0]].size()
      assert all(
          encoded_sentence[channel].size() == sentence_size
          for channel in encoded_sentence
      ), "Input tensors are expected to have the same size in all channels"
      return encoded_sentence
  
file_path: fairseq/fairseq/models/speech_dlm/hub_interface.py
imports: import copy
  import logging
  from typing import Any, Dict, Iterator, List
  import torch
  from fairseq import utils
  from omegaconf import open_dict
  from torch import nn
  from tqdm import tqdm
  from fairseq.hub_utils import GeneratorHubInterface
label_desc: Use image node_id 5 for calling the MultichannelGeneratorHubInterface obj's underlying member method code with example usage: obj.encode(sentence) and returns: encoded_sentence