code: def _get_text(self, idx: int) -> np.ndarray:
      # Get the shuffled index.
      idx = self.shuffle_idx[idx]
      # Start and end documents and offsets.
      doc_index_f = self.sample_idx[idx][0]
      doc_index_l = self.sample_idx[idx + 1][0]
      offset_f = self.sample_idx[idx][1]
      offset_l = self.sample_idx[idx + 1][1]
      # If we are within the same document, just extract the chunk.
      if doc_index_f == doc_index_l:
          sample = self.indexed_dataset.get(
              self.doc_idx[doc_index_f],
              offset=offset_f,
              length=offset_l - offset_f + self.add_extra_token,
          )
      else:
          # Otherwise, get the rest of the initial document.
          sample_list = [
              self.indexed_dataset.get(
                  self.doc_idx[doc_index_f], offset=offset_f
              )
          ]
          # Loop over all in between documents and add the entire document.
          for i in range(doc_index_f + 1, doc_index_l):
              sample_list.append(
                  self.indexed_dataset.get(self.doc_idx[i])
              )
          # And finally add the relevant portion of last document.
          sample_list.append(
              self.indexed_dataset.get(
                  self.doc_idx[doc_index_l],
                  length=offset_l + self.add_extra_token,
              )
          )
          sample = np.concatenate(sample_list)
      if len(sample) != (self.seq_length + self.add_extra_token):
          logging.info(
              f" > WARNING: Got sample of length: {len(sample)} for sequence length={self.seq_length+self.add_extra_token}, padding the sample to match sequence length"
          )
          sample = np.array(sample, dtype=np.int64)
          sample = np.pad(
              sample,
              (0, self.seq_length + self.add_extra_token - len(sample)),
              mode="constant",
              constant_values=-1,
          )
      return sample.astype(np.int64)
  
imports: import os
  import time
  import numpy
  import torch
  from omegaconf.dictconfig import DictConfig
  from nemo.collections.nlp.data.language_modeling.megatron.base_dataset_utils import get_datasets_weights_and_num_samples, get_train_valid_test_split_
  from nemo.collections.nlp.data.language_modeling.megatron.blendable_dataset import BlendableDataset
  from nemo.collections.nlp.data.language_modeling.megatron.indexed_dataset import deallocate_indexed_dataset_memory
  from nemo.collections.nlp.data.language_modeling.megatron.indexed_dataset import make_dataset
  from nemo.core import Dataset
  from nemo.utils import logging
label_desc: Use image node_id 4 for calling the GPTDataset obj's underlying member method code with example usage: obj._get_text(idx) and returns: sample