kd.from_xid.get_resolved

kd.from_xid.get_resolved#

kauldron.utils.from_xid.get_resolved(xid: int, wid: int = 1, *, path: str | None = None, adhoc_from: None | str | int = None, config_update_fn: typing.Callable[[typing.Any], typing.Any] = <function <lambda>>) Any[source]

Returns the resolved config/sub-config from an xmanager experiment.

Note: By default, the config from XManager is resolved using the current version of the code (not the same as used in the XM experiment). You can change this behavior by passing adhoc_from=, but only modules not yet in sys.modules will be adhoc imported.

If you only care about a sub-config, use path= to avoid resolving and depending on the whole config.

Parameters:
  • xid – The XID of the experiment to load the config from.

  • wid – ID of the worker to load the config from. Defaults to 1.

  • path – Path of the sub-config to resolve (e.g. model).

  • adhoc_from – If additional dependencies are needed to load the model, specify the source to adhoc import from. If adhoc_from is an int, it is assumed to be an XID and adhoc_from is set to f”xid/{adhoc_from}”.

  • config_update_fn – An optional function to update the config before resolving the model. Defaults to the identity function.

Returns:

The resolved kd.train.Trainer (or any other sub-field).