codes.train package#

Submodules#

codes.train.train_fcts module#

codes.train.train_fcts.create_task_list_for_surrogate(config, surr_name)#

Creates a list of training tasks for a specific surrogate model based on the configuration file.

Parameters:
  • config (dict) – The configuration dictionary taken from the config file.

  • surr_name (str) – The name of the surrogate model.

Returns:

A list of training tasks for the surrogate model.

Return type:

list

codes.train.train_fcts.parallel_training(tasks, device_list, task_list_filepath)#

Execute the training tasks in parallel on multiple devices.

Parameters:
  • tasks (list) – The list of training tasks.

  • device_list (list) – The list of devices to use for training.

  • task_list_filepath (str) – The filepath to the task list file.

codes.train.train_fcts.sequential_training(tasks, device_list, task_list_filepath)#

Execute the training tasks sequentially on a single device.

Parameters:
  • tasks (list) – The list of training tasks.

  • device_list (list) – The list of devices to use for training.

  • task_list_filepath (str) – The filepath to the task list file.

codes.train.train_fcts.train_and_save_model(surr_name, mode, metric, training_id, seed=None, epochs=None, device='cpu', position=1)#

Train and save a model for a specific benchmark mode. The parameters are determined by the task(s) which is created from the config file.

Parameters:
  • surr_name (str) – The name of the surrogate model.

  • mode (str) – The benchmark mode (e.g. “main”, “interpolation”, “extrapolation”).

  • metric (int) – The metric for the benchmark mode.

  • training_id (str) – The training ID for the current training session.

  • seed (int, optional) – The random seed for the training. Defaults to None.

  • epochs (int, optional) – The number of epochs for the training. Defaults to None.

  • device (str, optional) – The device for the training. Defaults to “cpu”.

  • position (int, optional) – The position of the model in the task list. Defaults to 1.

codes.train.train_fcts.worker(task_queue, device, device_idx, overall_progress_bar, task_list_filepath)#

Worker function to process tasks from the task queue on the given device.

Parameters:
  • task_queue (Queue) – The task queue containing the training tasks.

  • device (str) – The device to use for training.

  • device_idx (int) – The index of the device in the device list.

  • overall_progress_bar (tqdm) – The overall progress bar for the training.

  • task_list_filepath (str) – The filepath to the task list file

Module contents#

codes.train.create_task_list_for_surrogate(config, surr_name)#

Creates a list of training tasks for a specific surrogate model based on the configuration file.

Parameters:
  • config (dict) – The configuration dictionary taken from the config file.

  • surr_name (str) – The name of the surrogate model.

Returns:

A list of training tasks for the surrogate model.

Return type:

list

codes.train.parallel_training(tasks, device_list, task_list_filepath)#

Execute the training tasks in parallel on multiple devices.

Parameters:
  • tasks (list) – The list of training tasks.

  • device_list (list) – The list of devices to use for training.

  • task_list_filepath (str) – The filepath to the task list file.

codes.train.sequential_training(tasks, device_list, task_list_filepath)#

Execute the training tasks sequentially on a single device.

Parameters:
  • tasks (list) – The list of training tasks.

  • device_list (list) – The list of devices to use for training.

  • task_list_filepath (str) – The filepath to the task list file.

codes.train.train_and_save_model(surr_name, mode, metric, training_id, seed=None, epochs=None, device='cpu', position=1)#

Train and save a model for a specific benchmark mode. The parameters are determined by the task(s) which is created from the config file.

Parameters:
  • surr_name (str) – The name of the surrogate model.

  • mode (str) – The benchmark mode (e.g. “main”, “interpolation”, “extrapolation”).

  • metric (int) – The metric for the benchmark mode.

  • training_id (str) – The training ID for the current training session.

  • seed (int, optional) – The random seed for the training. Defaults to None.

  • epochs (int, optional) – The number of epochs for the training. Defaults to None.

  • device (str, optional) – The device for the training. Defaults to “cpu”.

  • position (int, optional) – The position of the model in the task list. Defaults to 1.

codes.train.worker(task_queue, device, device_idx, overall_progress_bar, task_list_filepath)#

Worker function to process tasks from the task queue on the given device.

Parameters:
  • task_queue (Queue) – The task queue containing the training tasks.

  • device (str) – The device to use for training.

  • device_idx (int) – The index of the device in the device list.

  • overall_progress_bar (tqdm) – The overall progress bar for the training.

  • task_list_filepath (str) – The filepath to the task list file