code: def prepare_dataloader(
      dataset: Dataset[CharDataset],
      batch_size: int,
      device: torch.device,
  ) -> torch.utils.data.DataLoader:
      """Instantiate DataLoader"""
      # pin_memory enables faster host to GPU copies
      on_cuda = device.type == "cuda"
      return torch.utils.data.DataLoader(
          dataset=dataset,
          batch_size=batch_size,
          pin_memory=on_cuda,
      )
  
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 1 for calling a global function with example usage: prepare_dataloader(dataset, batch_size, device) and returns: torch