The demo, smoke-tests and eval subcommands have different purposes. Smoke exercises the configured model; a saved checkpoint is needed where the evaluation path expects one.
{"revision":"4e51d6aee7b901e42115d44380a15caacb44e940","sources":[{"file":"demo/MuZero-style-v0/config/muzero_demo.yaml","content":"# MuZero-style AGI Jobs demo configuration\nowner:\n pause_planning: false\n max_capital_per_action: 2500.0\n governance_contact: \"owner@agijobs.example\"\n\nexperiment:\n seed: 17\n device: \"cpu\"\n episodes: 48\n evaluation_episodes: 64\n artifact_dir: \"demo/MuZero-style-v0/artifacts\"\n\nenvironment:\n episode_length: 6\n job_pool_size: 5\n success_noise: 0.08\n discount: 0.997\n max_budget: 10000.0\n stochastic_fail_penalty: 0.2\n\nnetwork:\n observation_dim: 27\n hidden_dim: 64\n latent_dim: 48\n reward_support: [-4, 4]\n value_support: [-20, 20]\n policy_temperature: 1.0\n\nplanner:\n enable_muzero_planning: true\n default_simulations: 96\n max_simulations: 256\n exploration_constant: 1.5\n dirichlet_alpha: 0.3\n dirichlet_epsilon: 0.25\n temperature: 1.0\n visit_temperature_schedule:\n warmup_episode: 24\n min_temperature: 0.05\n\nthermostat:\n enable: true\n low_entropy_threshold: 0.25\n high_entropy_threshold: 0.65\n min_simulations: 32\n max_simulations: 192\n latency_budget_ms: 140\n simulation_cost_ms: 1.1\n\nsentinel:\n enable: true\n value_error_alpha: 0.1\n value_error_threshold: 0.9\n drift_window: 12\n fallback_on_violation: true\n\ntraining:\n batch_size: 32\n unroll_steps: 5\n td_steps: 5\n learning_rate: 0.0008\n weight_decay: 0.000001\n replay_capacity: 2048\n warmup_steps: 32\n reanalyse_ratio: 0.25\n value_loss_weight: 0.9\n reward_loss_weight: 1.0\n policy_loss_weight: 1.0\n checkpoint_interval: 16\n\ntelemetry:\n enable: true\n flush_interval: 5\n prometheus_format: false\n sample_rate: 1.0\n\nbaselines:\n greedy_immediacy_bias: 0.05\n policy_temperature: 0.7\n","format":"text","sha256":"6f98c9ebe6ec98bb696d833b90c53880308246a00799c668567ca601cc66778d","bytes":1593,"download":"/AGIJobsv0/examples/6f98c9ebe6ec98bb-muzero_demo.yaml","source":"https://github.com/MontrealAI/AGIJobsv0/blob/4e51d6aee7b901e42115d44380a15caacb44e940/demo/MuZero-style-v0/config/muzero_demo.yaml"},{"file":"demo/MuZero-style-v0/muzero_demo/mcts.py","content":"\"\"\"Monte Carlo tree search utilities for the MuZero-style demo.\"\"\"\nfrom __future__ import annotations\n\nfrom dataclasses import dataclass\nfrom typing import Iterable, List, Sequence, Tuple\n\nimport torch\n\nfrom .network import MuZeroNetwork, NetworkOutput\n\n\n@dataclass\nclass PlannerSettings:\n \"\"\"High level planner controls exposed to configuration.\"\"\"\n\n num_simulations: int = 32\n temperature: float = 1.0\n\n\nclass MuZeroPlanner:\n \"\"\"Lightweight planner that masks illegal actions and normalises policies.\"\"\"\n\n def __init__(self, network: MuZeroNetwork, settings: PlannerSettings | None = None) -> None:\n self.network = network\n self.settings = settings or PlannerSettings()\n\n def run(self, observation: torch.Tensor, legal_actions: Sequence[int]) -> Tuple[torch.Tensor, float, int, int]:\n \"\"\"Compute an action distribution for ``observation``.\"\"\"\n\n if observation.dim() != 1:\n observation = observation.view(-1)\n with torch.no_grad():\n output: NetworkOutput = self.network.initial_inference(observation.unsqueeze(0))\n logits = output.policy_logits.squeeze(0)\n mask = torch.full_like(logits, float(\"-inf\"))\n mask[list(legal_actions)] = 0.0\n temperature = max(self.settings.temperature, 1e-6)\n policy = torch.softmax((logits + mask) / temperature, dim=-1)\n value = float(output.value.squeeze().item())\n action = int(policy.argmax().item())\n return policy, value, action, self.settings.num_simulations\n\n @staticmethod\n def normalise_visit_counts(counts: Iterable[float]) -> List[float]:\n tensor = torch.tensor(list(counts), dtype=torch.float32)\n if tensor.sum() <= 0:\n tensor = torch.ones_like(tensor)\n tensor = tensor / tensor.sum()\n return tensor.tolist()\n\n\nclass _SearchNode:\n \"\"\"Lightweight container mirroring the tree node interface used by the planner.\"\"\"\n\n def __init__(self, value: float) -> None:\n self._value = value\n\n def value(self) -> float:\n return self._value\n\n\nclass MCTS:\n \"\"\"Simplified Monte Carlo Tree Search used by the CLI/demo entrypoints.\n\n The full MuZero search is intentionally compressed here: we estimate visit counts\n directly from the policy head and propagate the scalar value for downstream\n consumers. This keeps the public API compatible with the planner while avoiding\n a heavy dependency graph for the runnable demo script.\n \"\"\"\n\n def __init__(self, network: MuZeroNetwork, config: dict) -> None:\n self.network = network\n env_conf = config.get(\"environment\", {})\n self.action_space = int(env_conf.get(\"max_jobs\", 5)) + 1\n\n def run(self, observation: torch.Tensor, simulations: int) -> Tuple[_SearchNode, List[float]]:\n if observation.dim() != 1:\n observation = observation.view(-1)\n with torch.no_grad():\n output: NetworkOutput = self.network.initial_inference(observation.unsqueeze(0))\n policy_logits = output.policy_logits.squeeze(0)\n probabilities = torch.softmax(policy_logits, dim=-1)\n visit_counts = (probabilities * float(simulations)).tolist()\n root = _SearchNode(float(output.value.squeeze().item()))\n return root, visit_counts\n\n @staticmethod\n def final_policy(visit_counts: Sequence[float], temperature: float) -> List[float]:\n counts = torch.tensor(list(visit_counts), dtype=torch.float32)\n temperature = max(temperature, 1e-6)\n adjusted = counts / temperature\n adjusted = torch.nan_to_num(adjusted, nan=1.0 / max(len(visit_counts), 1), posinf=1.0, neginf=1e-6)\n probabilities = torch.softmax(adjusted, dim=0)\n return probabilities.tolist()\n\n\n__all__ = [\"MuZeroPlanner\", \"PlannerSettings\", \"MCTS\"]\n","format":"text","sha256":"51faffb9fff0fdff4ba3b87d3aef74a44cac8590ac565dfe4d6260249facc63d","bytes":3805,"download":"/AGIJobsv0/examples/51faffb9fff0fdff-mcts.py","source":"https://github.com/MontrealAI/AGIJobsv0/blob/4e51d6aee7b901e42115d44380a15caacb44e940/demo/MuZero-style-v0/muzero_demo/mcts.py"},{"file":"demo/MuZero-style-v0/muzero_demo/cli.py","content":"\"\"\"Command-line interface for MuZero demo.\"\"\"\n\nfrom __future__ import annotations\n\nimport argparse\n\n\n# Preserve the established callable API without importing the training stack for help.\ndef __getattr__(name):\n if name in {\n \"run_demo\",\n \"run_smoke_tests\",\n \"run_eval\",\n \"load_config\",\n \"prepare_device\",\n }:\n from . import cli_runtime\n\n return getattr(cli_runtime, name)\n raise AttributeError(name)\n\n\nparser = argparse.ArgumentParser(description=\"MuZero-style AGI Jobs demo\")\nsubparsers = parser.add_subparsers(dest=\"command\")\n\ndemo_parser = subparsers.add_parser(\n \"demo\", help=\"Train and evaluate the MuZero planner\"\n)\ndemo_parser.add_argument(\"--config\", required=True, help=\"Path to configuration YAML\")\n\nsmoke_parser = subparsers.add_parser(\"smoke-tests\", help=\"Run smoke tests for the demo\")\nsmoke_parser.add_argument(\"--config\", required=True, help=\"Path to configuration YAML\")\n\neval_parser = subparsers.add_parser(\"eval\", help=\"Evaluate strategies only\")\neval_parser.add_argument(\"--config\", required=True, help=\"Path to configuration YAML\")\n\n\ndef app(argv: list[str] | None = None) -> None:\n args = parser.parse_args(argv)\n if args.command is None:\n parser.print_help()\n return\n try:\n from . import cli_runtime\n except ModuleNotFoundError as exc:\n if exc.name not in {\"torch\", \"numpy\", \"yaml\"}:\n raise\n parser.exit(\n 2,\n f\"MuZero runtime dependency '{exc.name}' is missing. \"\n \"Install PyTorch for your platform and demo/MuZero-style-v0/requirements.txt in a dedicated environment, \"\n \"then retry this command. No training was started.\\n\",\n )\n commands = {\n \"demo\": cli_runtime.run_demo,\n \"smoke-tests\": cli_runtime.run_smoke_tests,\n \"eval\": cli_runtime.run_eval,\n }\n commands[args.command](args.config)\n\n\nif __name__ == \"__main__\":\n app()\n","format":"text","sha256":"f097503602c57e76f15578e3e6e57e2877d365a3dbeff950954b2bd9dba295c3","bytes":1955,"download":"/AGIJobsv0/examples/f097503602c57e76-cli.py","source":"https://github.com/MontrealAI/AGIJobsv0/blob/4e51d6aee7b901e42115d44380a15caacb44e940/demo/MuZero-style-v0/muzero_demo/cli.py"}]}
FROM READING TO A REPRODUCIBLE RUN
Try the selected path.
Isolated Python environment
Use Python 3.12 in a virtual environment. Install this demo’s tracked requirements file when present, then run python -m pip check. Some variants have additional requirements: follow the selected implementation’s guide, not an unrelated demo’s dependency list.
The smoke path checks the selected configuration and model behavior. Use the demo subcommand for the longer training journey and inspect its checkpoint before eval.
The source inspector above reads bundled repository material. Local commands run separately on your computer. Recorded examples may contain historical timestamps, placeholders and simulated metrics.
MAKE IT YOUR OWN
One useful experiment.
Compare search budgets while holding environment and seed fixed. Account for both reward and extra computation.
THE SYSTEM, MADE VISIBLE
Architecture & relationships
Architecture diagram · source preserved belowView original Mermaid source
flowchart LR
Operators((Mission Owners)) --> demo_MuZero_style_v0[[Demo → MuZero style v0]]
demo_MuZero_style_v0 --> Core[["AGI Jobs v0 (v2) Core Intelligence"]]
Core --> Observability[[Unified CI / CD & Observability]]
Core --> Governance[[Owner Control Plane]]
WHEN SOMETHING DOESN’T MATCH
Troubleshooting
Import or dependency error
Confirm the active virtual environment and the selected demo’s requirements. Run python -m pip check; do not install unrelated demo requirements over a working environment.
Unexpected result or missing file
Check the selected entry point, configuration and output argument. Keep the seed and implementation fixed before comparing outcomes.
TRACE THE CHECKS
Verification & next steps
8 tracked test source files are available in this directory. Inspect the tests and their environment before choosing a suite; file counts do not establish test results.