ksuit.providers.path_provider

Classes

PathProvider

Provider that defines at which locations things are stored on the disk. The basic layout is that every training

Module Contents

class ksuit.providers.path_provider.PathProvider(output_root_path, run_id, stage_name=None, debug=False)

Provider that defines at which locations things are stored on the disk. The basic layout is that every training run is identified by a stage_name (e.g., “pretrain” or “finetune”) and run_id, a string that is unique for each training run. All outputs are stored in a directory defined in the configuration that is located in output_path. The outputs of a single run will be stored in output_path/stage_name/run_id.

Parameters:
  • output_root_path (pathlib.Path) – The base output directory where outputs should be stored (e.g., /save).

  • run_id (str) – Unique identifier of the training run.

  • stage_name (str | None) – Optional identifier for the training stage for easier categorization (e.g., “pretrain” or “finetune”).

  • debug (bool) – If True, outputs are stored in a “debug” subfolder.

output_root
stage_name = None
run_id
debug = False
with_run(run_id=None, stage_name=None)
Parameters:
  • run_id (str | None)

  • stage_name (str | None)

Return type:

PathProvider

property run_output_path: pathlib.Path

Returns the output_path for a given stage_name and run_id.

Returns:

The output path for the current run.

Return type:

pathlib.Path

property logfile_uri: pathlib.Path

Returns the URI where the logfile should be stored (the file where stdout messsage are stored).

Return type:

pathlib.Path

property checkpoint_path: pathlib.Path

Returns the checkpoint path of the current run.

Return type:

pathlib.Path

property basetracker_config_uri: pathlib.Path

Independent of whether or not (or which) online tracker is used, the log entries are also written to disk. This property defines where the config is written to.

Return type:

pathlib.Path

property basetracker_entries_uri: pathlib.Path

Independent of whether or not (or which) online tracker is used, the log entries are also written to disk. This property defines where the log entries are written to.

Return type:

pathlib.Path

property basetracker_summary_uri: pathlib.Path

Independent of whether or not (or which) online tracker is used, the log entries are also written to disk. This property defines where the summary is written to.

Return type:

pathlib.Path

static generate_run_id(seed=None)

Generate a random run ID.

Parameters:

seed – Optional seed for reproducibility.

Returns:

A random run ID.

Return type:

str

Create a symlink from the current run output path to the target run output path for resuming.

Parameters:
  • target – The target PathProvider to link to.

  • ancestor (PathProvider)

Return type:

None