class_docstr: T0 (https://arxiv.org/abs/2110.08207) Model that Inherits from MegatronT5SFTModel and overrides the dataset building.
code: def setup(self, stage=None):
      # NOTE: super().__init__ will try and setup train/val/test datasets, but we sidestep this using a if self._train_ds is not None condition
      # We then set things up for real only once setup() of this class is called.
      resume_checkpoint_path = self.trainer.ckpt_path
      if resume_checkpoint_path:
          init_consumed_samples = (
              self._extract_consumed_samples_from_ckpt(
                  resume_checkpoint_path
              )
          )
      else:
          init_consumed_samples = 0
      self.init_consumed_samples = init_consumed_samples
  
      if stage == "predict":
          return
  
      # If the user wants to manually override train and validation dataloaders before calling `.fit()`
      if self._train_dl is not None and self._validation_dl is not None:
          return
      self.build_train_valid_test_datasets(stage=stage)
      if hasattr(self, "_train_ds"):
          self.setup_training_dataloader()
      if hasattr(self, "_validation_ds"):
          self._validation_dl = self.setup_eval_dataloader(
              self._validation_ds, self.cfg.data.validation_ds
          )
      if hasattr(self.cfg.data, "test_ds"):
          self._test_dl = self.setup_test_data(
              self._test_ds, self.cfg.data.test_ds
          )
  
      # when using pipeline model parallel the final stage need to initialize word embeddings
      if parallel_state.get_pipeline_model_parallel_world_size() > 1:
          self.enc_dec_model.sync_initial_word_embeddings()
          # Only synchronize position embeddings if using absolute position embeddings in both the encoder and decoder.
          if (
              self.cfg.encoder.get(
                  "position_embedding_type", "learned_absolute"
              )
              == "learned_absolute"
              and self.cfg.decoder.get(
                  "position_embedding_type", "learned_absolute"
              )
              == "learned_absolute"
          ):
              self.enc_dec_model.sync_initial_position_embeddings()
  
imports: import torch
  from omegaconf import DictConfig, ListConfig
  from pytorch_lightning.trainer.trainer import Trainer
  from nemo.collections.nlp.data.language_modeling.megatron.base_dataset_utils import get_datasets_weights_and_num_samples
  from nemo.collections.nlp.data.language_modeling.megatron.blendable_dataset import BlendableDataset
  from nemo.collections.nlp.data.language_modeling.megatron.megatron_batch_samplers import MegatronPretrainingBatchSampler
  from nemo.collections.nlp.data.language_modeling.t0_dataset import T0Dataset
  from nemo.collections.nlp.models.language_modeling.megatron_t5_sft_model import MegatronT5SFTModel
  from nemo.utils import AppState, logging
label_desc: Use image node_id 2 for calling the MegatronT0Model obj's underlying member method code with example usage: obj.setup(stage) without return types