synth-ai 0.2.12__py3-none-any.whl → 0.2.13.dev2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of synth-ai might be problematic. Click here for more details.
- examples/multi_step/configs/crafter_rl_outcome.toml +74 -0
- examples/multi_step/configs/crafter_rl_stepwise_hosted_judge.toml +186 -0
- examples/multi_step/configs/crafter_rl_stepwise_shaped.toml +83 -0
- examples/multi_step/configs/crafter_rl_stepwise_simple.toml +78 -0
- examples/multi_step/crafter_rl_lora.md +51 -10
- examples/multi_step/sse_metrics_streaming_notes.md +357 -0
- examples/multi_step/task_app_config_notes.md +7 -1
- examples/swe/task_app/grpo_swe_mini.py +55 -26
- examples/swe/task_app/hosted/rollout.py +40 -0
- examples/swe/task_app/hosted/test_service.py +5 -6
- examples/task_apps/TESTING.md +275 -0
- examples/task_apps/__init__.py +0 -0
- examples/task_apps/crafter/__init__.py +0 -0
- examples/task_apps/crafter/task_app/__init__.py +2 -0
- examples/{warming_up_to_rl → task_apps/crafter}/task_app/grpo_crafter.py +21 -46
- examples/{warming_up_to_rl → task_apps/crafter}/task_app/grpo_crafter_task_app.py +1 -1
- examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/envs/crafter/policy.py +60 -4
- examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/inference/openai_client.py +109 -45
- examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/policy_routes.py +67 -49
- examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/rollout.py +242 -193
- examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/test_service.py +5 -6
- examples/task_apps/dev/pokemon_emerald/__init__.py +2 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/README.md +811 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/agent/__init__.py +120 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/agent/action.py +160 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/agent/memory.py +155 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/agent/perception.py +69 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/agent/planning.py +96 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/agent/simple.py +1502 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/agent/system_prompt.py +4 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/grab_map.py +68 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/manual.py +216 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/pokemon_env/__init__.py +35 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/pokemon_env/emerald_utils.py +631 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/pokemon_env/emulator.py +1544 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/pokemon_env/enums.py +1428 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/pokemon_env/memory_reader.py +4848 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/pokemon_env/types.py +41 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/pokemon_env/utils.py +298 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/pyproject.toml +95 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/run.py +204 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/server/__init__.py +0 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/server/app.py +2152 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/server/client.py +429 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/server/frame_server.py +155 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/README.md +78 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/__init__.py +0 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/run_tests.py +122 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_agent_direct.py +76 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_agent_prompts.py +413 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_battle_state_formatting.py +204 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_dialogue_detection.py +133 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_dialogue_detection_comprehensive.py +229 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_direct_agent_emulator.py +300 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_fps_adjustment_pytest.py +205 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_house_to_outside_direct.py +200 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_house_to_outside_transition.py +284 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_map_ground_truth_comparison.py +468 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_memory_map.py +575 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_server_map_validation.py +311 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/tests/test_torchic_state.py +259 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/__init__.py +0 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/anticheat.py +372 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/checkpoint.py +296 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/error_handler.py +275 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/get_local_ip.py +22 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/helpers.py +44 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/llm_logger.py +514 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/map_formatter.py +415 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/map_stitcher.py +1763 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/map_stitcher_singleton.py +33 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/map_trimmer.py +106 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/map_visualizer.py +334 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/ocr_dialogue.py +1020 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/recording.py +188 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/state_formatter.py +1481 -0
- examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun/utils/vlm.py +862 -0
- examples/task_apps/dev/pokemon_emerald/modal_app.py +114 -0
- examples/task_apps/dev/pokemon_emerald/task_app/README.md +81 -0
- examples/task_apps/dev/pokemon_emerald/task_app/__init__.py +6 -0
- examples/task_apps/dev/pokemon_emerald/task_app/pokemon_emerald.py +685 -0
- examples/task_apps/enron/__init__.py +1 -0
- examples/task_apps/enron/eval_groq_qwen32.toml +16 -0
- examples/task_apps/enron/task_app/README.md +14 -0
- examples/task_apps/enron/task_app/__init__.py +1 -0
- examples/task_apps/enron/task_app/grpo_enron.py +906 -0
- examples/task_apps/enron/task_app/grpo_enron_task_app.py +146 -0
- examples/task_apps/enron/tests/__init__.py +2 -0
- examples/task_apps/enron/tests/conftest.py +115 -0
- examples/task_apps/enron/tests/integration/__init__.py +2 -0
- examples/task_apps/enron/tests/integration/test_enron_eval.py +177 -0
- examples/task_apps/enron/tests/integration/test_enron_rollout.py +135 -0
- examples/task_apps/enron/tests/unit/__init__.py +2 -0
- examples/task_apps/enron/tests/unit/test_enron_environment.py +126 -0
- examples/task_apps/math/__init__.py +0 -0
- examples/{rl/task_app → task_apps/math}/math_single_step.py +19 -10
- examples/task_apps/pokemon_battle/__init__.py +2 -0
- examples/task_apps/pokemon_battle/modal_app.py +104 -0
- examples/task_apps/pokemon_battle/task_app/README.md +68 -0
- examples/task_apps/pokemon_battle/task_app/__init__.py +6 -0
- examples/task_apps/pokemon_battle/task_app/pokemon_showdown.py +932 -0
- examples/task_apps/pokemon_red/README.md +357 -0
- examples/task_apps/pokemon_red/__init__.py +3 -0
- examples/task_apps/pokemon_red/eval_pokemon_red_policy.py +225 -0
- examples/task_apps/pokemon_red/pallet_town_rl_config.toml +73 -0
- examples/task_apps/pokemon_red/task_app.py +606 -0
- examples/task_apps/pokemon_red/test_pallet_town_rewards.py +191 -0
- examples/task_apps/sokoban/README.md +307 -0
- examples/task_apps/sokoban/__init__.py +3 -0
- examples/task_apps/sokoban/eval_groq_qwen32.toml +16 -0
- examples/task_apps/sokoban/eval_openai_gpt5.toml +16 -0
- examples/task_apps/sokoban/task_app.py +1058 -0
- examples/task_apps/sokoban/tests/__init__.py +2 -0
- examples/task_apps/sokoban/tests/conftest.py +113 -0
- examples/task_apps/sokoban/tests/integration/__init__.py +2 -0
- examples/task_apps/sokoban/tests/integration/test_sokoban_eval.py +57 -0
- examples/task_apps/sokoban/tests/integration/test_sokoban_rollout.py +198 -0
- examples/task_apps/sokoban/tests/unit/__init__.py +2 -0
- examples/task_apps/sokoban/tests/unit/test_sokoban_environment.py +114 -0
- examples/task_apps/verilog/__init__.py +1 -0
- examples/task_apps/verilog/eval_groq_qwen32b.toml +20 -0
- examples/task_apps/verilog/task_app/README.md +12 -0
- examples/task_apps/verilog/task_app/__init__.py +1 -0
- examples/task_apps/verilog/task_app/grpo_verilog.py +931 -0
- examples/task_apps/verilog/task_app/grpo_verilog_task_app.py +145 -0
- examples/task_apps/verilog/tests/__init__.py +2 -0
- examples/task_apps/verilog/tests/conftest.py +115 -0
- examples/task_apps/verilog/tests/integration/__init__.py +2 -0
- examples/task_apps/verilog/tests/integration/test_verilog_eval.py +179 -0
- examples/task_apps/verilog/tests/integration/test_verilog_rollout.py +55 -0
- examples/task_apps/verilog/tests/unit/__init__.py +2 -0
- examples/task_apps/verilog/tests/unit/test_verilog_scoring.py +118 -0
- examples/vlm/crafter_openai_vlm_agent.py +4 -4
- examples/vlm/run_crafter_vlm_benchmark.py +4 -4
- examples/warming_up_to_rl/configs/eval_stepwise_complex.toml +4 -2
- examples/warming_up_to_rl/configs/eval_stepwise_simple.toml +4 -2
- examples/warming_up_to_rl/run_eval.py +127 -18
- examples/workflows/__init__.py +0 -0
- examples/workflows/math_rl/__init__.py +0 -0
- examples/workflows/math_rl/download_dataset.py +80 -0
- synth_ai/__init__.py +41 -1
- synth_ai/api/train/builders.py +73 -29
- synth_ai/api/train/cli.py +12 -6
- synth_ai/api/train/configs/__init__.py +44 -0
- synth_ai/api/train/configs/rl.py +134 -0
- synth_ai/api/train/configs/sft.py +95 -0
- synth_ai/api/train/configs/shared.py +24 -0
- synth_ai/api/train/env_resolver.py +5 -2
- synth_ai/api/train/supported_algos.py +10 -5
- synth_ai/api/train/utils.py +7 -4
- synth_ai/cli/__init__.py +7 -51
- synth_ai/cli/_storage.py +4 -3
- synth_ai/cli/_validate_task_app.py +11 -0
- synth_ai/cli/balance.py +4 -3
- synth_ai/cli/calc.py +2 -2
- synth_ai/cli/demo.py +49 -43
- synth_ai/cli/legacy_root_backup.py +1 -1
- synth_ai/cli/rl_demo.py +86 -106
- synth_ai/cli/root.py +0 -97
- synth_ai/cli/task_apps.py +1710 -186
- synth_ai/demos/core/cli.py +121 -159
- synth_ai/demos/demo_task_apps/crafter/grpo_crafter_task_app.py +28 -16
- synth_ai/environments/examples/crafter_classic/environment.py +16 -0
- synth_ai/environments/examples/enron/engine.py +7 -2
- synth_ai/environments/examples/enron/environment.py +68 -0
- synth_ai/environments/examples/red/engine.py +27 -0
- synth_ai/environments/examples/red/engine_helpers/memory_map.py +7 -0
- synth_ai/environments/examples/red/engine_helpers/reward_library/pallet_town_progression.py +477 -0
- synth_ai/environments/examples/red/engine_helpers/state_extraction.py +32 -0
- synth_ai/environments/examples/red/environment.py +60 -0
- synth_ai/environments/examples/sokoban/taskset.py +116 -0
- synth_ai/environments/examples/verilog/engine.py +30 -4
- synth_ai/evals/__init__.py +15 -0
- synth_ai/evals/client.py +82 -0
- synth_ai/evals/types.py +42 -0
- synth_ai/jobs/client.py +16 -4
- synth_ai/judge_schemas.py +127 -0
- synth_ai/py.typed +0 -0
- synth_ai/task/__init__.py +14 -5
- synth_ai/task/contracts.py +124 -38
- synth_ai/task/proxy.py +48 -56
- synth_ai/task/rubrics/__init__.py +53 -0
- synth_ai/task/rubrics/loaders.py +133 -0
- synth_ai/task/rubrics/models.py +57 -0
- synth_ai/task/rubrics/scoring.py +113 -0
- synth_ai/task/rubrics/strict.py +149 -0
- synth_ai/task/server.py +8 -7
- synth_ai/task/validators.py +269 -6
- synth_ai/tracing_v3/decorators.py +7 -3
- synth_ai/tracing_v3/replica_sync.py +4 -4
- synth_ai/tracing_v3/serialization.py +130 -0
- synth_ai/tracing_v3/trace_utils.py +317 -0
- synth_ai/tracing_v3/turso/native_manager.py +3 -3
- {synth_ai-0.2.12.dist-info → synth_ai-0.2.13.dev2.dist-info}/METADATA +4 -1
- {synth_ai-0.2.12.dist-info → synth_ai-0.2.13.dev2.dist-info}/RECORD +228 -89
- {synth_ai-0.2.12.dist-info → synth_ai-0.2.13.dev2.dist-info}/entry_points.txt +0 -1
- synth_ai/task/rubrics.py +0 -219
- /examples/{warming_up_to_rl → task_apps/crafter}/task_app/README.md +0 -0
- /examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/README.md +0 -0
- /examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/__init__.py +0 -0
- /examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/branching.py +0 -0
- /examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/environment_routes.py +0 -0
- /examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/envs/__init__.py +0 -0
- /examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/envs/crafter/__init__.py +0 -0
- /examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/envs/crafter/app.py +0 -0
- /examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/envs/crafter/environment.py +0 -0
- /examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/envs/crafter/react_agent.py +0 -0
- /examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/envs/crafter/shared.py +0 -0
- /examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/envs/crafter/tools.py +0 -0
- /examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/hosted_app.py +0 -0
- /examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/inference/__init__.py +0 -0
- /examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/main.py +0 -0
- /examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/registry.py +0 -0
- /examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/storage/__init__.py +0 -0
- /examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/storage/volume.py +0 -0
- /examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/test_agents.py +0 -0
- /examples/{warming_up_to_rl → task_apps/crafter}/task_app/synth_envs_hosted/utils.py +0 -0
- /examples/{rl/task_app → task_apps/math}/README.md +0 -0
- /examples/{rl/task_app → task_apps/math}/math_task_app.py +0 -0
- /examples/{rl → workflows/math_rl}/configs/eval_base_qwen.toml +0 -0
- /examples/{rl → workflows/math_rl}/configs/eval_rl_qwen.toml +0 -0
- /examples/{rl → workflows/math_rl}/configs/rl_from_base_qwen.toml +0 -0
- /examples/{rl → workflows/math_rl}/configs/rl_from_base_qwen17.toml +0 -0
- /examples/{rl → workflows/math_rl}/configs/rl_from_ft_qwen.toml +0 -0
- /examples/{rl → workflows/math_rl}/run_eval.py +0 -0
- /examples/{rl → workflows/math_rl}/run_rl_and_save.py +0 -0
- {synth_ai-0.2.12.dist-info → synth_ai-0.2.13.dev2.dist-info}/WHEEL +0 -0
- {synth_ai-0.2.12.dist-info → synth_ai-0.2.13.dev2.dist-info}/licenses/LICENSE +0 -0
- {synth_ai-0.2.12.dist-info → synth_ai-0.2.13.dev2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"""Modal deployment helper for the Pokémon Emerald speedrun task app example.
|
|
2
|
+
|
|
3
|
+
This reproduces the manual setup described in the README:
|
|
4
|
+
|
|
5
|
+
- Clone `pokeagent-speedrun` and install its Python (and mGBA) dependencies.
|
|
6
|
+
- Mount the Synth AI repository so the task app can be imported directly.
|
|
7
|
+
- Mount a Modal volume that stores the ROM and savestates used by the environment.
|
|
8
|
+
|
|
9
|
+
Deploy with:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
modal deploy examples/task_apps/pokemon_emerald/modal_app.py
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Before deploying, upload `emerald.gba` and any required savestate files to the
|
|
16
|
+
`pokemon-emerald-assets` volume (see the README for `modal volume put` examples).
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
import subprocess
|
|
22
|
+
import sys
|
|
23
|
+
from pathlib import Path
|
|
24
|
+
|
|
25
|
+
import modal
|
|
26
|
+
|
|
27
|
+
REPO_ROOT = Path(__file__).resolve().parents[3]
|
|
28
|
+
POKEAGENT_SPEEDRUN_REPO = "https://github.com/sethkarten/pokeagent-speedrun.git"
|
|
29
|
+
|
|
30
|
+
app = modal.App("pokemon-emerald-task-app-example")
|
|
31
|
+
|
|
32
|
+
BASE_IMAGE = (
|
|
33
|
+
modal.Image.debian_slim(python_version="3.11")
|
|
34
|
+
.apt_install(
|
|
35
|
+
"git",
|
|
36
|
+
"cmake",
|
|
37
|
+
"ninja-build",
|
|
38
|
+
"build-essential",
|
|
39
|
+
"pkg-config",
|
|
40
|
+
"libpng-dev",
|
|
41
|
+
"libzip-dev",
|
|
42
|
+
"libepoxy-dev",
|
|
43
|
+
"libavcodec-dev",
|
|
44
|
+
"libavformat-dev",
|
|
45
|
+
"libavutil-dev",
|
|
46
|
+
"libswscale-dev",
|
|
47
|
+
"zlib1g-dev",
|
|
48
|
+
"libgles2-mesa-dev",
|
|
49
|
+
"libegl1-mesa-dev",
|
|
50
|
+
)
|
|
51
|
+
.pip_install(["uvicorn[standard]", "fastapi", "httpx", "horizons-ai"])
|
|
52
|
+
.run_commands(
|
|
53
|
+
[
|
|
54
|
+
"mkdir -p /external",
|
|
55
|
+
f"if [ ! -d /external/pokeagent-speedrun ]; then git clone --depth 1 {POKEAGENT_SPEEDRUN_REPO} /external/pokeagent-speedrun; fi",
|
|
56
|
+
"pip install --no-cache-dir -r /external/pokeagent-speedrun/requirements.txt",
|
|
57
|
+
]
|
|
58
|
+
)
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
REPO_MOUNT = modal.Mount.from_local_dir(REPO_ROOT, remote_path="/workspace/synth-ai")
|
|
62
|
+
ASSET_VOLUME = modal.Volume.from_name("pokemon-emerald-assets", create_if_missing=True)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@app.function(
|
|
66
|
+
image=BASE_IMAGE,
|
|
67
|
+
mounts=[REPO_MOUNT],
|
|
68
|
+
volumes={"/assets": ASSET_VOLUME},
|
|
69
|
+
timeout=900,
|
|
70
|
+
memory=9216,
|
|
71
|
+
cpu=4.0,
|
|
72
|
+
secrets=[modal.Secret.from_name("environment-api-key")],
|
|
73
|
+
keep_warm=1,
|
|
74
|
+
)
|
|
75
|
+
@modal.asgi_app()
|
|
76
|
+
def fastapi_app():
|
|
77
|
+
"""Serve the Synth task app via Modal."""
|
|
78
|
+
|
|
79
|
+
import os
|
|
80
|
+
|
|
81
|
+
repo_path = Path("/workspace/synth-ai").resolve()
|
|
82
|
+
if str(repo_path) not in sys.path:
|
|
83
|
+
sys.path.insert(0, str(repo_path))
|
|
84
|
+
|
|
85
|
+
marker = Path("/tmp/.synth_ai_editable")
|
|
86
|
+
if not marker.exists():
|
|
87
|
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "-e", str(repo_path)])
|
|
88
|
+
marker.touch()
|
|
89
|
+
|
|
90
|
+
os.environ.setdefault("POKEAGENT_SPEEDRUN_ROOT", "/external/pokeagent-speedrun")
|
|
91
|
+
os.environ.setdefault("POKEMON_EMERALD_ASSETS", "/assets")
|
|
92
|
+
|
|
93
|
+
rom_path = Path(os.getenv("POKEMON_EMERALD_ROM", "/assets/emerald.gba"))
|
|
94
|
+
if not rom_path.exists():
|
|
95
|
+
raise RuntimeError(
|
|
96
|
+
f"Missing ROM at {rom_path}. Upload it with "
|
|
97
|
+
"\"modal volume put pokemon-emerald-assets emerald.gba\" before deployment."
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
from examples.task_apps.pokemon_emerald.task_app.pokemon_emerald import build_config
|
|
101
|
+
from synth_ai.task.server import create_task_app
|
|
102
|
+
|
|
103
|
+
return create_task_app(build_config())
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
@app.local_entrypoint()
|
|
107
|
+
def main():
|
|
108
|
+
"""Print usage hints for local operators."""
|
|
109
|
+
|
|
110
|
+
print("Pokémon Emerald task app Modal helper")
|
|
111
|
+
print("Upload assets: modal volume put pokemon-emerald-assets /path/to/emerald.gba")
|
|
112
|
+
print("Optional savestates can also be uploaded to the same volume.")
|
|
113
|
+
print("Deploy with: modal deploy examples/task_apps/pokemon_emerald/modal_app.py")
|
|
114
|
+
print("Test locally: modal serve examples/task_apps/pokemon_emerald/modal_app.py")
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Pokemon Emerald Task App
|
|
2
|
+
|
|
3
|
+
This directory contains a task app for the PokéAgent Track 2 speedrunning
|
|
4
|
+
environment. It wraps the `pokeagent-speedrun` mGBA integration in the Horizons
|
|
5
|
+
environment API so agents trained with Synth AI can reset, step, snapshot, and
|
|
6
|
+
restore deterministically.
|
|
7
|
+
|
|
8
|
+
## Local setup (Track 2)
|
|
9
|
+
|
|
10
|
+
1. Clone and install the **pokeagent-speedrun** project (brings in the mGBA
|
|
11
|
+
Python bindings and emulator helpers). A snapshot of the repository is
|
|
12
|
+
vendored under `examples/task_apps/dev/pokemon_emerald/external/pokeagent-speedrun`,
|
|
13
|
+
but you can also clone a separate working copy if you prefer to track upstream:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
git clone https://github.com/sethkarten/pokeagent-speedrun.git
|
|
17
|
+
cd pokeagent-speedrun
|
|
18
|
+
pip install -r requirements.txt
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Installing `mgba==0.10.2` may require system packages such as `cmake`,
|
|
22
|
+
`ninja-build`, `pkg-config`, `libpng-dev`, `libzip-dev`, and the FFmpeg
|
|
23
|
+
libraries listed in the repo README.
|
|
24
|
+
|
|
25
|
+
2. Provide a legal copy of the Pokémon Emerald ROM and any savestate
|
|
26
|
+
checkpoints you wish to use. Place them in a known directory.
|
|
27
|
+
|
|
28
|
+
3. Export environment variables so the task app can locate both the repository
|
|
29
|
+
and the assets:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
export POKEAGENT_SPEEDRUN_ROOT=/path/to/pokeagent-speedrun # or the vendored path under examples/task_apps/dev/pokemon_emerald/external
|
|
33
|
+
export POKEMON_EMERALD_ROM=/path/to/emerald.gba
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
4. Run a rollout to validate the wiring:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
uv run python -m synth_ai.task.describe pokemon_emerald
|
|
40
|
+
uv run python -m synth_ai.task.rollout pokemon_emerald --seed 4001
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Modal deployment
|
|
44
|
+
|
|
45
|
+
`examples/task_apps/pokemon_emerald/modal_app.py` packages the same workflow for
|
|
46
|
+
Modal. It clones `pokeagent-speedrun`, installs dependencies (including mGBA),
|
|
47
|
+
and mounts a persistent volume (`pokemon-emerald-assets`) where you can upload
|
|
48
|
+
the ROM and savestates:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
modal volume put pokemon-emerald-assets /path/to/emerald.gba
|
|
52
|
+
modal deploy examples/task_apps/pokemon_emerald/modal_app.py
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
After deployment, point Synth AI workflows at the issued `modal.run` URL.
|
|
56
|
+
|
|
57
|
+
## Notes (Not Yet Ready)
|
|
58
|
+
|
|
59
|
+
- The adapter currently requires manual mgba installation (`mgba==0.10.2`),
|
|
60
|
+
which is not automated for Apple Silicon—treat this example as
|
|
61
|
+
**experimental** until we land a turnkey build recipe.
|
|
62
|
+
- Dataset entries report savestate availability, but some scenarios may still
|
|
63
|
+
lack assets locally; `/info` will surface this.
|
|
64
|
+
- Snapshot/restore wiring is complete, yet we have not validated
|
|
65
|
+
deterministic parity across platforms pending a reliable mgba install flow.
|
|
66
|
+
- Actions are exposed as macro buttons; further tuning is needed once the
|
|
67
|
+
runtime environment is stable.
|
|
68
|
+
|
|
69
|
+
## Status & Next Steps
|
|
70
|
+
|
|
71
|
+
- **Environment readiness (blocker)**: provide a reproducible mgba installation
|
|
72
|
+
path (possibly via prebaked wheels or containerized build) before relying on
|
|
73
|
+
this adapter.
|
|
74
|
+
- **Visual observations**: once runtime is reliable, keep the base64 PNG output
|
|
75
|
+
and validate frame fidelity across platforms.
|
|
76
|
+
- **Macro tuning**: calibrate macro durations and add higher-level navigation
|
|
77
|
+
macros.
|
|
78
|
+
- **Reward shaping**: extend badge/location bonuses with richer event hooks.
|
|
79
|
+
- **Stability checks**: add regression tests for snapshot/restore determinism.
|
|
80
|
+
- **Agent integration**: publish rollout scripts after environment setup is
|
|
81
|
+
automated.
|