class_docstr: Class that manages the training loop. See speechbrain.core.Brain.
docstr: Predicts the next word given the previous ones.
  
  Arguments
  ---------
  batch : PaddedBatch
      This batch object contains all the relevant tensors for computation.
  stage : sb.Stage
      One of sb.Stage.TRAIN, sb.Stage.VALID, or sb.Stage.TEST.
  
  Returns
  -------
  predictions : torch.Tensor
      A tensor containing the posterior probabilities (predictions).
docstr_tok: ["Predicts","the","next","word","given","the","previous","ones",".","Arguments","--","--","--","--","-","batch",":","PaddedBatch","This","batch","object","contains","all","the","relevant","tensors","for","computation",".","stage",":","sb.Stage","One","of","sb.Stage.TRAIN",",","sb.Stage.VALID",",","or","sb.Stage.TEST",".","Returns","--","--","--","-","predictions",":","torch.Tensor","A","tensor","containing","the","posterior","probabilities","(","predictions",")","."]
code: def compute_forward(self, batch, stage):
      """Predicts the next word given the previous ones.
  
      Arguments
      ---------
      batch : PaddedBatch
          This batch object contains all the relevant tensors for computation.
      stage : sb.Stage
          One of sb.Stage.TRAIN, sb.Stage.VALID, or sb.Stage.TEST.
  
      Returns
      -------
      predictions : torch.Tensor
          A tensor containing the posterior probabilities (predictions).
      """
      batch = batch.to(self.device)
      tokens_bos, _ = batch.tokens_bos
      pred = self.hparams.model(tokens_bos)
      return pred
  
file_path: speechbrain/templates/speech_recognition/LM/train.py
imports: import sys
  import logging
  import torch
  from datasets import load_dataset
  from hyperpyyaml import load_hyperpyyaml
  import speechbrain
  from speechbrain.utils.distributed import run_on_main
label_desc: Use image node_id 1 for calling the LM obj's underlying member method code with example usage: obj.compute_forward(batch, stage) and returns: pred