kd.xm.Experiment

kd.xm.Experiment#

class kauldron.utils.xmanager.Experiment(
exp: <Mock name='mock.Experiment' id='132096850213456'>,
*,
wid: int,
lazy: bool = False,
)[source]

Bases: object

XManager experiment wrapper.

Usage:

xp = kd.xm.Experiment.from_xid(1234)

with xp.adhoc():  # Import from xid
  from kauldron import kd

  config = kd.konfig.resolve(xp.config)

xp.root_dir.rmtree()
exp: <Mock name='mock.Experiment' id='132096850213456'>
wid: int
lazy: bool = False
classmethod from_xid(
xid: int,
wid: int,
*,
lazy: bool = False,
) kauldron.utils.xmanager.Experiment[source]

Factory from an xid.

Parameters:
  • xid – Experiment id

  • wid – Work unit id

  • lazy – Specify how the imports should be resolved. If lazy=False (default), the imports are resolved during xp.config access. If lazy=True, the imports are resolved during konfig.resolve.

Returns:

The experiment object

adhoc() collections.abc.Iterator[None][source]

Adhoc imports from the experiment snapshot.

property wu: kauldron.utils.xmanager.WorkUnit
property artifacts: dict[str, str]

Mapping artifact name -> value.

property root_dir: etils.epath.abstract_path.Path

Root directory of the artifact.

property config: konfig.ConfigDictLike[trainer_lib.Trainer]

Unresolved ConfigDict.

property trainer: trainer_lib.Trainer

Resolved ConfigDict.