trinity.utils.monitor module#

Monitor

trinity.utils.monitor.gather_metrics(metric_list: List[Dict], prefix: str, output_stats: List[str] = ['mean', 'max', 'min']) Dict[源代码]#
trinity.utils.monitor.gather_eval_metrics(metric_list: List[Dict], prefix: str, output_stats: List[str] = ['mean', 'max', 'min', 'std'], detailed_stats: bool = False) Dict[源代码]#
class trinity.utils.monitor.Monitor(project: str, name: str, role: str, config: Config = None)[源代码]#

基类:ABC

__init__(project: str, name: str, role: str, config: Config = None) None[源代码]#
abstractmethod log_table(table_name: str, experiences_table: DataFrame, step: int)[源代码]#

Log a table

abstractmethod log(data: dict, step: int, commit: bool = False) None[源代码]#

Log metrics.

abstractmethod close() None[源代码]#

Close the monitor

calculate_metrics(data: dict[str, List[float] | float], prefix: str | None = None) dict[str, float][源代码]#
classmethod default_args() Dict[源代码]#

Return default arguments for the monitor.

class trinity.utils.monitor.TensorboardMonitor(project: str, group: str, name: str, role: str, config: Config = None)[源代码]#

基类:Monitor

__init__(project: str, group: str, name: str, role: str, config: Config = None) None[源代码]#
log_table(table_name: str, experiences_table: DataFrame, step: int)[源代码]#

Log a table

log(data: dict, step: int, commit: bool = False) None[源代码]#

Log metrics.

close() None[源代码]#

Close the monitor

class trinity.utils.monitor.WandbMonitor(project: str, group: str, name: str, role: str, config: Config = None)[源代码]#

基类:Monitor

Monitor with Weights & Biases.

参数:
  • 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[源代码]#
log_table(table_name: str, experiences_table: DataFrame, step: int)[源代码]#

Log a table

log(data: dict, step: int, commit: bool = False) None[源代码]#

Log metrics.

close() None[源代码]#

Close the monitor

classmethod default_args() Dict[源代码]#

Return default arguments for the monitor.

class trinity.utils.monitor.MlflowMonitor(project: str, group: str, name: str, role: str, config: Config = None)[源代码]#

基类:Monitor

Monitor with MLflow.

参数:
  • 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[源代码]#
log_table(table_name: str, experiences_table: DataFrame, step: int)[源代码]#

Log a table

log(data: dict, step: int, commit: bool = False) None[源代码]#

Log metrics.

close() None[源代码]#

Close the monitor

classmethod default_args() Dict[源代码]#

Return default arguments for the monitor.

class trinity.utils.monitor.SwanlabMonitor(project: str, group: str, name: str, role: str, config: Config = None)[源代码]#

基类:Monitor

Monitor with SwanLab (https://swanlab.cn/).

Set SWANLAB_API_KEY environment variable with your SwanLab API key before using this monitor. If you're using local deployment of Swanlab, also set SWANLAB_API_HOST environment variable. Pass additional SwanLab initialization arguments via config.monitor.monitor_args in the Config, such as tags, description, logdir, etc. See SwanLab documentation for details.

__init__(project: str, group: str, name: str, role: str, config: Config = None) None[源代码]#
log_table(table_name: str, experiences_table: DataFrame, step: int)[源代码]#

Log a table

log(data: dict, step: int, commit: bool = False) None[源代码]#

Log metrics.

close() None[源代码]#

Close the monitor

classmethod default_args() Dict[源代码]#

Return default arguments for the monitor.