Skip to content

Folder Versioning

Source

Utilities for folder versioning.

get_run_version(root_folder, folder_name)

Get the version run based on experiment folder name.

Versioned folder starts at <folder_name>_0 and is incremented based on the content of the root folder. This method is intended to be used for creating checkpoint folders for each training run, without mixing up checkpoints. It should mimick the csv logger.

Parameters:

  • root_folder (str | Path) –

    The root folder where the versioned folders are located.

  • folder_name (str) –

    The name of the versioned folder.

Returns:

  • int

    The version number for the new run, which is one higher than the highest existing version number. If no versioned folders exist, it returns 0.