duo_ai.core.config

Classes

MasterConfig

Main configuration class for the Duo framework.

Functions

configure(→ None)

Set up experiment directory, logging, random seeds, and global variables for the experiment.

Module Contents

class duo_ai.core.config.MasterConfig[source]

Main configuration class for the Duo framework.

This class holds all experiment-level configuration, including environment, policy, algorithm, evaluation, and coordination settings.

Parameters:
  • name (str, optional) – Name of the experiment. Default is “default”.

  • device (int, optional) – Device index for CUDA. Default is 0.

  • seed (int, optional) – Random seed for reproducibility. Default is 10.

  • env (Any, optional) – Environment configuration or name. Default is “procgen”.

  • policy (Any, optional) – Policy configuration or name. Default is “PPOPolicy”.

  • algorithm (Any, optional) – Algorithm configuration or name. Default is “PPOAlgorithm”.

  • evaluation (Any, optional) – Evaluation configuration. Default is None.

  • eval_name (str, optional) – Name for evaluation run. Default is None.

  • overwrite (bool, optional) – Whether to overwrite existing experiment directory. Default is False.

  • use_wandb (bool, optional) – Whether to use Weights & Biases logging. Default is False.

  • experiment_dir (str, optional) – Path to the experiment directory. Default is “”.

  • train_novice (str, optional) – Path to novice training checkpoint. Default is None.

  • train_expert (str, optional) – Path to expert training checkpoint. Default is None.

  • test_novice (str, optional) – Path to novice test checkpoint. Default is None.

  • test_expert (str, optional) – Path to expert test checkpoint. Default is None.

  • coordination (Any, optional) – Coordination configuration. Default is None.

Examples

>>> config = MasterConfig(name="my_experiment", env="procgen", policy="PPOPolicy")
name: str = 'default'
device: int = 0
seed: int = 10
env: Any = 'procgen'
policy: Any = 'PPOPolicy'
algorithm: Any = 'PPOAlgorithm'
evaluation: Any = None
eval_mode: int | None = None
eval_name: str | None = None
overwrite: bool = False
use_wandb: bool = False
experiment_dir: str = ''
train_novice: str | None = None
train_expert: str | None = None
test_novice: str | None = None
test_expert: str | None = None
coordination: Any = None
__post_init__() None[source]

Post-initialization logic for MasterConfig.

Converts string or dictionary fields for env, policy, algorithm, evaluation, and coordination into their respective configuration objects.

Raises:
  • IndexError – If required keys are missing in configuration dictionaries.

  • ValueError – If configuration fields are not of expected types.

Examples

>>> config = MasterConfig(env={"name": "procgen"})
>>> config.__post_init__()
duo_ai.core.config.configure(config: MasterConfig) None[source]

Set up experiment directory, logging, random seeds, and global variables for the experiment.

Parameters:

config (MasterConfig) – The experiment configuration object.

Return type:

None

Raises:

FileExistsError – If the experiment directory exists and overwrite is not set.

Examples

>>> configure(config)