code: def get_datasets(
      data_cfg: DataConfig,
  ) -> Tuple[Subset[CharDataset], Subset[CharDataset], CharDataset]:
      dataset = CharDataset(data_cfg)
      train_len = int(len(dataset) * data_cfg.train_split)
      train_set, eval_set = random_split(
          dataset, [train_len, len(dataset) - train_len]
      )
      return train_set, eval_set, dataset
  
imports: import argparse
  import logging
  import tempfile
  from argparse import Namespace
  from typing import Optional, Tuple
  import torch
  from libfb.py import parutil
  from torch.utils.data import random_split
  from torch.utils.data.dataset import Dataset, Subset
  from torchtnt.examples.mingpt.char_dataset import CharDataset, DataConfig
  from torchtnt.examples.mingpt.model import create_optimizer, GPT, GPTConfig, OptimizerConfig
  from torchtnt.framework.auto_unit import AutoUnit, TrainStepResults
  from torchtnt.framework.fit import fit
  from torchtnt.framework.state import State
  from torchtnt.utils import init_from_env, seed, TLRScheduler
  from torchtnt.utils.loggers import TensorBoardLogger
label_desc: Use image node_id 2 for calling a global function with example usage: get_datasets(data_cfg) and returns: train_set,  eval_set,  dataset