class_docstr: Megatron encoder-decoder base class
class_docstr_tok: ["Megatron","encoder-decoder","base","class"]
code: def forward(
      self,
      encoder_input_ids,
      decoder_input_ids,
      encoder_attn_mask,
      decoder_attn_mask,
      token_type_ids=None,
      lm_labels=None,
      enc_output=None,
      enc_output_attn_mask=None,
      output_enc_hidden_only=False,
      enc_input=None,
  ):
      output_tensor = self.enc_dec_model(
          enc_input_ids=encoder_input_ids,
          dec_input_ids=decoder_input_ids,
          enc_attn_mask=encoder_attn_mask,
          dec_attn_mask=decoder_attn_mask,
          token_type_ids=token_type_ids,
          labels=lm_labels,
          enc_output=enc_output,
          enc_output_attn_mask=enc_output_attn_mask,
          output_enc_hidden_only=output_enc_hidden_only,
          enc_input=enc_input,
      )
  
      return output_tensor
  
imports: import copy
  import functools
  import inspect
  from typing import Any, Dict, List, Optional
  import torch
  from omegaconf import OmegaConf, open_dict
  from omegaconf.dictconfig import DictConfig
  from pytorch_lightning.accelerators import CPUAccelerator
  from pytorch_lightning.trainer.trainer import Trainer
  from nemo.collections.nlp.data.language_modeling.megatron.data_samplers import MegatronPretrainingRandomSampler, MegatronPretrainingSampler
  from nemo.collections.nlp.models.language_modeling.megatron_base_model import MegatronBaseModel
  from nemo.collections.nlp.modules.common.megatron.build_model import build_model
  from nemo.collections.nlp.modules.common.megatron.module import Float16Module
  from nemo.collections.nlp.modules.common.megatron.token_level_encoder_decoder import MegatronTokenLevelEncoderDecoderModule
  from nemo.collections.nlp.modules.common.megatron.utils import ApexGuardDefaults, average_losses_across_data_parallel_group, get_params_for_weight_decay_optimization
  from nemo.collections.nlp.modules.common.text_generation_utils import compute_beam_search_len_penalty, get_sampling_token_fn
  from nemo.collections.nlp.parts.utils_funcs import get_last_rank
  from nemo.utils import AppState, logging
label_desc: Use image node_id 7 for calling the MegatronLMEncoderDecoderModel obj's underlying member method code with example usage: obj.forward(encoder_input_ids, decoder_input_ids, encoder_attn_mask, decoder_attn_mask, token_type_ids, lm_labels, enc_output, enc_output_attn_mask, output_enc_hidden_only, enc_input) and returns: output_tensor