trinity.utils.monitor module#
Monitor
- trinity.utils.monitor.gather_metrics(metric_list: List[Dict], prefix: str, output_stats: List[str] = ['mean', 'max', 'min']) Dict[source]#
- class trinity.utils.monitor.Monitor(project: str, name: str, role: str, config: Config = None)[source]#
Bases:
ABC- abstractmethod log_table(table_name: str, experiences_table: DataFrame, step: int)[source]#
Log a table
- class trinity.utils.monitor.TensorboardMonitor(project: str, group: str, name: str, role: str, config: Config = None)[source]#
Bases:
Monitor
- class trinity.utils.monitor.WandbMonitor(project: str, group: str, name: str, role: str, config: Config = None)[source]#
Bases:
MonitorMonitor 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.
- class trinity.utils.monitor.MlflowMonitor(project: str, group: str, name: str, role: str, config: Config = None)[source]#
Bases:
MonitorMonitor 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.
- class trinity.utils.monitor.SwanlabMonitor(project: str, group: str, name: str, role: str, config: Config = None)[source]#
Bases:
MonitorMonitor with SwanLab.
This monitor integrates with SwanLab (https://swanlab.cn/) to track experiments.
- Supported monitor_args in config.monitor.monitor_args:
- api_key (Optional[str]): API key for swanlab.login(). If omitted, will read from env
(SWANLAB_API_KEY, SWANLAB_APIKEY, SWANLAB_KEY, SWANLAB_TOKEN) or assume prior CLI login.
workspace (Optional[str]): Organization/username workspace.
mode (Optional[str]): “cloud” | “local” | “offline” | “disabled”.
logdir (Optional[str]): Local log directory when in local/offline modes.
experiment_name (Optional[str]): Explicit experiment name. Defaults to “{name}_{role}”.
description (Optional[str]): Experiment description.
tags (Optional[List[str]]): Tags to attach. Role and group are appended automatically.
id (Optional[str]): Resume target run id (21 chars) when using resume modes.
resume (Optional[Literal[‘must’,’allow’,’never’]|bool]): Resume policy.
reinit (Optional[bool]): Whether to re-init on repeated init() calls.