codes.utils.utils

codes.utils.utils#

Functions

check_training_status(config)

Check if the training is already completed by looking for a completion marker file.

create_model_dir([base_dir, subfolder, ...])

Create a directory based on a unique identifier inside a specified subfolder of the base directory.

get_progress_bar(tasks)

Create a progress bar with a specific description.

load_and_save_config([config_path, save])

Load configuration from a YAML file and save a copy to the specified directory.

load_task_list(filepath)

Load a list of tasks from a JSON file.

make_description(mode, device, metric, ...)

Create a formatted description for the progress bar that ensures consistent alignment.

nice_print(message[, width])

Print a message in a nicely formatted way with a fixed width.

read_yaml_config(config_path)

save_task_list(tasks, filepath)

Save a list of tasks to a JSON file.

set_random_seeds(seed)

Set random seeds for reproducibility.

time_execution(func)

Decorator to time the execution of a function and store the duration as an attribute of the function.

worker_init_fn(worker_id)

Initialize the random seed for each worker in PyTorch DataLoader.