class_docstr: Megatron Bert pretraining.
  Model returns [batch, seq, hidden] shape
class_docstr_tok: ["Megatron","Bert","pretraining",".","Model","returns","[","batch",",","seq",",","hidden","]","shape"]
code: def build_train_valid_test_datasets(self):
      # Override limit_val_batches to be a multiple of num microbatches to prevent val_step from exiting in between a step
      self._reconfigure_val_batches()
      logging.info("Building Bert datasets.")
      if self.trainer.limit_val_batches > 1.0 and isinstance(
          self.trainer.limit_val_batches, float
      ):
          raise ValueError(
              "limit_val_batches must be an integer or float less than or equal to 1.0."
          )
      global_batch_size = self.cfg.global_batch_size
      # Compute trianing micro-batch steps: total_global_batch_steps x grad_acumms_per_global_batch
      max_train_steps = self.trainer.max_steps
      eval_iters = (
          max_train_steps // self.trainer.val_check_interval + 1
      ) * self.trainer.limit_val_batches
      test_iters = self.trainer.limit_test_batches
  
      train_valid_test_num_samples = [
          max_train_steps * global_batch_size,
          eval_iters * global_batch_size,
          test_iters * global_batch_size,
      ]
  
      if self.trainer.limit_val_batches <= 1.0 and isinstance(
          self.trainer.limit_val_batches, float
      ):
          train_valid_test_num_samples[
              1
          ] = 1  # This is to make sure we only have one epoch on every validation iteration
  
      (
          self._train_ds,
          self._validation_ds,
          self._test_ds,
      ) = dataset_utils.build_train_valid_test_datasets(
          cfg=self.cfg,
          trainer=self.trainer,
          data_prefix=self.cfg.data.data_prefix,
          data_impl=self.cfg.data.data_impl,
          splits_string=self.cfg.data.splits_string,
          train_valid_test_num_samples=train_valid_test_num_samples,
          max_seq_length=self.cfg.data.seq_length,
          masked_lm_prob=self.cfg.data.masked_lm_prob,
          short_seq_prob=self.cfg.data.short_seq_prob,
          seed=self.cfg.seed,
          skip_warmup=self.cfg.data.get("skip_warmup", True),
          binary_head=self.cfg.bert_binary_head,
          max_seq_length_dec=None,
          dataset_type="standard_bert",
          tokenizer=self.tokenizer.tokenizer,
      )
  
      if self._train_ds is not None:
          logging.info(
              f"Length of train dataset: {len(self._train_ds)}"
          )
      if self._validation_ds is not None:
          logging.info(
              f"Length of val dataset: {len(self._validation_ds)}"
          )
      if self._test_ds is not None:
          logging.info(f"Length of test dataset: {len(self._test_ds)}")
      logging.info(f"Finished building Bert datasets.")
      return self._train_ds, self._validation_ds, self._test_ds
  
imports: import itertools
  from typing import Any, Dict, List, Optional
  import torch
  import torch.nn.functional
  from omegaconf.dictconfig import DictConfig
  from pytorch_lightning.trainer.trainer import Trainer
  from nemo.collections.nlp.data.language_modeling.megatron import dataset_utils
  from nemo.collections.nlp.data.language_modeling.megatron.data_samplers import MegatronPretrainingRandomSampler, MegatronPretrainingSampler
  from nemo.collections.nlp.models.language_modeling.megatron.bert_model import BertModel
  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.utils import ApexGuardDefaults, average_losses_across_data_parallel_group, get_params_for_weight_decay_optimization
  from nemo.collections.nlp.parts.nlp_overrides import GradScaler
  from nemo.collections.nlp.parts.utils_funcs import get_last_rank
  from nemo.core.classes.common import PretrainedModelInfo
  from nemo.core.neural_types import ChannelType, MaskType, NeuralType
  from nemo.utils import AppState, logging
label_desc: Use image node_id 14 for calling the MegatronBertModel obj's underlying member method code with example usage: obj.build_train_valid_test_datasets() and returns: self,  self,  self