code: def get_data(cfg: Any) -> Tuple[pd.DataFrame, pd.DataFrame]:
      """Prepares train and validation DataFrames.
  
      Args:
          cfg: input config
  
      Returns:
          Train and validation DataFrames
      """
  
      train_df, val_df = load_train_valid_data(cfg)
  
      if (
          hasattr(cfg.prediction, "metric_gpt_template")
          and cfg.prediction.metric_gpt_template == "mt-bench"
      ):
          if cfg.environment._local_rank == 0:
              logger.info(
                  "Overwriting validation data with MT-BENCH data. Please note that "
                  "respective metric is an approximation and might not fully match "
                  "the original implementation."
              )
          val_df = load_mt_bench_data(cfg)
  
      if cfg.dataset.data_sample < 1.0:
          if "Train" in cfg.dataset.data_sample_choice:
              train_df = sample_data(cfg, train_df)
          if "Validation" in cfg.dataset.data_sample_choice:
              val_df = sample_data(cfg, val_df)
  
      if cfg.training.train_validation_data:
          train_df = pd.concat([train_df, val_df], axis=0)
  
      train_df = cfg.dataset.dataset_class.preprocess_dataframe(
          train_df, cfg, mode="train"
      )
      val_df = cfg.dataset.dataset_class.preprocess_dataframe(
          val_df, cfg, mode="validation"
      )
  
      return train_df.reset_index(drop=True), val_df.reset_index(
          drop=True
      )
  
imports: import logging
  import math
  import os
  from typing import Any, DefaultDict, Dict, List, Optional, Tuple, Union, no_type_check
  import networkx
  import numpy
  import pandas
  import pyarrow.parquet
  import torch
  from sklearn.model_selection import GroupShuffleSplit, train_test_split
  from torch import distributed
  from torch.utils.data import DataLoader, Sampler, SequentialSampler
  from llm_studio.src.datasets.conversation_chain_handler import ConversationChainHandler
  from llm_studio.src.utils.exceptions import LLMDataException
  from llm_studio.src.utils.utils import PatchedAttribute, set_seed
label_desc: Use image node_id 7 for calling a global function with example usage: get_data(cfg) and returns: train_df,  val_df