class_docstr: Base Anomalib data module.
  
  Args:
      train_batch_size (int): Batch size used by the train dataloader.
      test_batch_size (int): Batch size used by the val and test dataloaders.
      num_workers (int): Number of workers used by the train, val and test dataloaders.
      test_split_mode (Optional[TestSplitMode], optional): Determines how the test split is obtained.
          Options: [none, from_dir, synthetic]
      test_split_ratio (float): Fraction of the train images held out for testing.
      val_split_mode (ValSplitMode): Determines how the validation split is obtained. Options: [none, same_as_test,
          from_test, synthetic]
      val_split_ratio (float): Fraction of the train or test images held our for validation.
      seed (int | None, optional): Seed used during random subset splitting.
class_docstr_tok: ["Base","Anomalib","data","module",".","Args",":","train_batch_size","(","int",")",":","Batch","size","used","by","the","train","dataloader",".","test_batch_size","(","int",")",":","Batch","size","used","by","the","val","and","test","dataloaders",".","num_workers","(","int",")",":","Number","of","workers","used","by","the","train",",","val","and","test","dataloaders",".","test_split_mode","(","Optional","[","TestSplitMode","]",",","optional",")",":","Determines","how","the","test","split","is","obtained",".","Options",":","[","none",",","from_dir",",","synthetic","]","test_split_ratio","(","float",")",":","Fraction","of","the","train","images","held","out","for","testing",".","val_split_mode","(","ValSplitMode",")",":","Determines","how","the","validation","split","is","obtained",".","Options",":","[","none",",","same_as_test",",","from_test",",","synthetic","]","val_split_ratio","(","float",")",":","Fraction","of","the","train","or","test","images","held","our","for","validation",".","seed","(","int","|","None",",","optional",")",":","Seed","used","during","random","subset","splitting","."]
docstr: Obtain the validation set based on the settings in the config.
docstr_tok: ["Obtain","the","validation","set","based","on","the","settings","in","the","config","."]
code: def _create_val_split(self) -> None:
      """Obtain the validation set based on the settings in the config."""
      if self.val_split_mode == ValSplitMode.FROM_TEST:
          # randomly sampled from test set
          self.test_data, self.val_data = random_split(
              self.test_data,
              self.val_split_ratio,
              label_aware=True,
              seed=self.seed,
          )
      elif self.val_split_mode == ValSplitMode.SAME_AS_TEST:
          # equal to test set
          self.val_data = self.test_data
      elif self.val_split_mode == ValSplitMode.SYNTHETIC:
          # converted from random training sample
          self.train_data, normal_val_data = random_split(
              self.train_data, self.val_split_ratio, seed=self.seed
          )
          self.val_data = SyntheticAnomalyDataset.from_dataset(
              normal_val_data
          )
      elif self.val_split_mode != ValSplitMode.NONE:
          raise ValueError(
              f"Unknown validation split mode: {self.val_split_mode}"
          )
  
imports: from __future__ import annotations
  import logging
  from abc import ABC
  from typing import Any
  from pandas import DataFrame
  from pytorch_lightning import LightningDataModule
  from pytorch_lightning.utilities.types import EVAL_DATALOADERS, TRAIN_DATALOADERS
  from torch.utils.data.dataloader import DataLoader, default_collate
  from anomalib.data.base.dataset import AnomalibDataset
  from anomalib.data.synthetic import SyntheticAnomalyDataset
  from anomalib.data.utils import TestSplitMode, ValSplitMode, random_split, split_by_label
label_desc: Use image node_id 5 for calling the AnomalibDataModule obj's underlying member method code with example usage: obj._create_val_split() without return types