trinity.utils.monitor module

Monitor

trinity.utils.monitor.gather_metrics(metric_list: List[Dict], prefix: str) Dict[source]
class trinity.utils.monitor.Monitor(project: str, name: str, role: str, config: Config | None = None)[source]

Bases: ABC

__init__(project: str, name: str, role: str, config: Config | None = None) None[source]
abstract log_table(table_name: str, experiences_table: DataFrame, step: int)[source]

Log a table

abstract log(data: dict, step: int, commit: bool = False) None[source]

Log metrics.

abstract close() None[source]

Close the monitor

calculate_metrics(data: dict[str, List[float] | float], prefix: str | None = None) dict[str, float][source]
classmethod default_args() Dict[source]

Return default arguments for the monitor.

class trinity.utils.monitor.TensorboardMonitor(project: str, group: str, name: str, role: str, config: Config | None = None)[source]

Bases: Monitor

__init__(project: str, group: str, name: str, role: str, config: Config | None = None) None[source]
log_table(table_name: str, experiences_table: DataFrame, step: int)[source]

Log a table

log(data: dict, step: int, commit: bool = False) None[source]

Log metrics.

close() None[source]

Close the monitor

class trinity.utils.monitor.WandbMonitor(project: str, group: str, name: str, role: str, config: Config | None = None)[source]

Bases: Monitor

Monitor with Weights & Biases.

Parameters:
  • base_url (Optional[str]) – The base URL of the W&B server. If not provided, use the environment variable WANDB_BASE_URL.

  • api_key (Optional[str]) – The API key for W&B. If not provided, use the environment variable WANDB_API_KEY.

__init__(project: str, group: str, name: str, role: str, config: Config | None = None) None[source]
log_table(table_name: str, experiences_table: DataFrame, step: int)[source]

Log a table

log(data: dict, step: int, commit: bool = False) None[source]

Log metrics.

close() None[source]

Close the monitor

classmethod default_args() Dict[source]

Return default arguments for the monitor.

class trinity.utils.monitor.MlflowMonitor(project: str, group: str, name: str, role: str, config: Config | None = None)[source]

Bases: Monitor

Monitor with MLflow.

Parameters:
  • uri (Optional[str]) – The tracking server URI. If not provided, the default is http://localhost:5000.

  • username (Optional[str]) – The username to login. If not provided, the default is None.

  • password (Optional[str]) – The password to login. If not provided, the default is None.

__init__(project: str, group: str, name: str, role: str, config: Config | None = None) None[source]
log_table(table_name: str, experiences_table: DataFrame, step: int)[source]

Log a table

log(data: dict, step: int, commit: bool = False) None[source]

Log metrics.

close() None[source]

Close the monitor

classmethod default_args() Dict[source]

Return default arguments for the monitor.