Experiment

Here is a tutorial on Google Colab that shows how to use the experiment module

Create Experiment

labml.experiment.create(*, uuid: str | None = None, name: str | None = None, python_file: str | None = None, comment: str | None = None, writers: Set[str] | None = None, ignore_callers: Set[str] | None = None, tags: Set[str] | None = None, distributed_rank: int = 0, distributed_world_size: int = 0, distributed_main_rank: int = 0, disable_screen: bool = False)[source]

Create an experiment

Keyword Arguments:
  • name (str, optional) – name of the experiment

  • python_file (str, optional) – path of the Python file that created the experiment

  • comment (str, optional) – a short description of the experiment

  • writers (Set[str], optional) – list of writers to write stat to. Defaults to {'screen', 'app'}.

  • ignore_callers – (Set[str], optional): list of files to ignore when automatically determining python_file

  • tags (Set[str], optional) – set of tags for experiment

  • distributed_rank (int, optional) – rank if this is a distributed training session

  • distributed_world_size (int, optional) – world_size if this is a distributed training session

labml.experiment.record(*, name: str | None = None, comment: str | None = None, writers: Set[str] | None = None, tags: Set[str] | None = None, exp_conf: Dict[str, any] | None = None, lab_conf: Dict[str, any] | None = None, app_url: str | None = None, distributed_rank: int = 0, distributed_world_size: int = 0, disable_screen: bool = False)[source]

This combines create(), configs() and start().

Keyword Arguments:
  • name (str, optional) – name of the experiment

  • comment (str, optional) – a short description of the experiment

  • writers (Set[str], optional) – list of writers to write stat to. Defaults to {'screen', 'app'}.

  • tags (Set[str], optional) – Set of tags for experiment

  • exp_conf (Dict[str, any], optional) – a dictionary of experiment configurations

  • lab_conf (Dict[str, any], optional) – a dictionary of configurations for LabML. Use this if you want to change default configurations such as app_track_url, and data_path.

  • app_url (str, optional) – a shortcut to provide LabML app url instead of including it in lab_conf. You can set this with labml.lab.configure(), or with a configuration file for the entire project.

  • distributed_rank (int, optional) – rank if this is a distributed training session

  • distributed_world_size (int, optional) – world_size if this is a distributed training session

labml.experiment.evaluate()[source]

This should be used for evaluation of a saved experiment. This will not record anything.

labml.experiment.start(global_step: int = 0)[source]

Starts the experiment. Run it using with statement and it will monitor and report, experiment completion and exceptions.

labml.experiment.get_uuid()[source]

Returns the UUID of the current experiment run

Configurations & Hyper-parameters

labml.experiment.configs(conf_dict: Dict[str, any])[source]
labml.experiment.configs(conf_dict: Dict[str, any], conf_override: Dict[str, any])
labml.experiment.configs(conf: BaseConfigs)
labml.experiment.configs(conf: BaseConfigs, conf_override: Dict[str, any])

Calculate configurations

This has multiple overloads

labml.experiment.configs(conf_dict: Dict[str, any])[source]
labml.experiment.configs(conf_dict: Dict[str, any], conf_override: Dict[str, any])[source]
labml.experiment.configs(conf: BaseConfigs)[source]
labml.experiment.configs(conf: BaseConfigs, run_order: List[List[str] | str])[source]
labml.experiment.configs(conf: BaseConfigs, *run_order: str)[source]
labml.experiment.configs(conf: BaseConfigs, conf_override: Dict[str, any])[source]
labml.experiment.configs(conf: BaseConfigs, conf_override: Dict[str, any], run_order: List[List[str] | str])[source]
labml.experiment.configs(conf: BaseConfigs, conf_override: Dict[str, any], *run_order: str)[source]
Parameters:
  • conf (BaseConfigs, optional) – configurations object

  • conf_dict (Dict[str, any], optional) – a dictionary of configs

  • conf_override (Dict[str, any], optional) – a dictionary of configs to be overridden

labml.experiment.load_configs(run_uuid: str, *, is_only_hyperparam: bool = True)[source]

Load configs of a previous run

Parameters:

run_uuid (str) – if provided the experiment will start from a saved state in the run with UUID run_uuid

Keyword Arguments:

is_only_hyperparam (bool, optional) – if True all only the hyper parameters are returned