Log Utils

class agilerl.utils.log_utils.DistributeCombineLogs(accelerator: Accelerator, use_wandb: bool = False)

Bases: object

accum_logs(logs: dict) None

Accumulates the logs.

Parameters:

logs (dict) – Logs to accumulate.

convert_key(k: tuple[str, ...]) tuple[str, ...]

Convert a key to a tuple.

Parameters:

k (tuple) – Key to convert.

Returns:

Converted key.

Return type:

tuple

count_tag = '__count__'
gather_logs(*postproc_funcs: Any, **additional_items: Any) dict

Gathers the logs.

Parameters:
  • postproc_funcs (list) – Post-processing functions.

  • additional_items (dict) – Additional items to log.

Returns:

Total logs.

Return type:

dict

key_is_count(k: tuple[str, ...]) bool

Check if a key is a count key.

Parameters:

k (tuple) – Key to check.

Returns:

True if the key is a count key, False otherwise.

Return type:

bool

log(*postproc_funcs: Any, **additional_items: Any) dict

Log the results.

Parameters:
  • postproc_funcs (list) – Post-processing functions.

  • additional_items (dict) – Additional items to log.

Returns:

Total logs.

Return type:

dict

reset_logs() None

Reset the logs.

Returns:

Total logs.

Return type:

dict

agilerl.utils.log_utils.label_logs(logs: dict, label: str) dict

Labels the logs.

Parameters:
  • logs (dict) – Logs to label.

  • label (str) – Label to add.

Returns:

Labeled logs.

Return type:

dict