class_docstr: Megatron T5 pretraining
class_docstr_tok: ["Megatron","T5","pretraining"]
docstr: Class-specific cfg validation
docstr_tok: ["Class-specific","cfg","validation"]
code: def _validate_cfg(self):
      """Class-specific cfg validation"""
      # Make sure the user specifies dataset type as either 't5' or 't5_prefix_lm' only.
      if self._cfg.data.get("dataset_type", None) is not None:
          if self._cfg.data.get("dataset_type") not in [
              "t5",
              "t5_prefix_lm",
              "ul2",
          ]:
              raise ValueError(
                  f"dataset_type must be either 't5', 't5_prefix_lm' or 'ul2'. found {self._cfg.data.get('dataset_type')}"
              )
  
      if (
          hasattr(self._cfg.data, "seq_length_dec")
          and self._cfg.data.get("dataset_type") == "t5"
      ):
          if (
              self._cfg.data.seq_length_dec
              < self._cfg.data.seq_length
              * self._cfg.data.masked_lm_prob
          ):
              raise ValueError(
                  f"Cannot have decoder max sequence length ({self._cfg.data.seq_length_dec}) less than encoder sequence length ({self._cfg.data.seq_length}) * masked_lm_prob ({self._cfg.data.masked_lm_prob})"
              )
  
      if self._cfg.data.get("dataset_type", "t5") == "ul2":
          if self._cfg.data.seq_length_dec != self._cfg.data.seq_length:
              raise ValueError(
                  f"Encoder and decoder sequence lengths must be the same while using the UL2 dataset type. Found encoder length {self._cfg.data.seq_length} and decoder length {self._cfg.data.seq_length_dec}"
              )
          if (
              self._cfg.tokenizer.num_sentinel_tokens
              < self._cfg.data.seq_length
              * self._cfg.data.extreme_masked_lm_prob
          ):
              raise ValueError(
                  f"Not enough sentinel tokens specified. Need at least {math.ceil(self._cfg.data.seq_length * self._cfg.data.extreme_masked_lm_prob)} sentinel tokens. Found {self._cfg.tokenizer.num_sentinel_tokens}"
              )
  
imports: import enum
  import math
  from omegaconf.dictconfig import DictConfig
  from pytorch_lightning.trainer.trainer import Trainer
  from nemo.collections.nlp.data.language_modeling.megatron.dataset_utils import build_train_valid_test_datasets
  from nemo.collections.nlp.models.language_modeling.megatron_lm_encoder_decoder_model import MegatronLMEncoderDecoderModel
  from nemo.utils import logging
label_desc: Use image node_id 3 for calling the MegatronT5Model obj's underlying member method code with example usage: obj._validate_cfg() without return types