synth-ai 0.2.9.dev4__py3-none-any.whl → 0.2.9.dev7__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/common_old/backend.py +0 -1
- examples/crafter_debug_render.py +15 -6
- examples/evals_old/compare_models.py +1 -0
- examples/finetuning_old/_backup_synth_qwen/filter_traces_achievements.py +6 -2
- examples/finetuning_old/_backup_synth_qwen/react_agent_lm.py +4 -4
- examples/finetuning_old/_backup_synth_qwen/sft_kickoff.py +4 -3
- examples/finetuning_old/synth_qwen_v1/filter_traces_achievements.py +6 -2
- examples/finetuning_old/synth_qwen_v1/finetune.py +1 -1
- examples/finetuning_old/synth_qwen_v1/hello_ft_model.py +4 -4
- examples/finetuning_old/synth_qwen_v1/infer.py +1 -2
- examples/finetuning_old/synth_qwen_v1/poll.py +4 -2
- examples/finetuning_old/synth_qwen_v1/prepare_data.py +8 -8
- examples/finetuning_old/synth_qwen_v1/react_agent_lm.py +5 -4
- examples/finetuning_old/synth_qwen_v1/run_crafter_sft_job.py +11 -8
- examples/finetuning_old/synth_qwen_v1/run_ft_job.py +17 -12
- examples/finetuning_old/synth_qwen_v1/upload_data.py +1 -1
- examples/finetuning_old/synth_qwen_v1/util.py +7 -2
- examples/rl/configs/eval_base_qwen.toml +1 -1
- examples/rl/configs/rl_from_base_qwen17.toml +1 -1
- examples/rl/download_dataset.py +26 -10
- examples/rl/run_eval.py +17 -15
- examples/rl/run_rl_and_save.py +24 -7
- examples/rl/task_app/math_single_step.py +128 -11
- examples/rl/task_app/math_task_app.py +11 -3
- examples/rl_old/task_app.py +222 -53
- examples/warming_up_to_rl/analyze_trace_db.py +7 -5
- examples/warming_up_to_rl/export_trace_sft.py +141 -16
- examples/warming_up_to_rl/groq_test.py +11 -4
- examples/warming_up_to_rl/manage_secrets.py +15 -6
- examples/warming_up_to_rl/readme.md +9 -2
- examples/warming_up_to_rl/run_eval.py +108 -30
- examples/warming_up_to_rl/run_fft_and_save.py +128 -52
- examples/warming_up_to_rl/run_local_rollout.py +87 -36
- examples/warming_up_to_rl/run_local_rollout_modal.py +113 -25
- examples/warming_up_to_rl/run_local_rollout_parallel.py +80 -16
- examples/warming_up_to_rl/run_local_rollout_traced.py +125 -20
- examples/warming_up_to_rl/run_rl_and_save.py +31 -7
- examples/warming_up_to_rl/run_rollout_remote.py +37 -10
- examples/warming_up_to_rl/task_app/grpo_crafter.py +90 -27
- examples/warming_up_to_rl/task_app/grpo_crafter_task_app.py +9 -27
- examples/warming_up_to_rl/task_app/synth_envs_hosted/environment_routes.py +46 -108
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/__init__.py +1 -1
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/crafter/__init__.py +1 -1
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/crafter/app.py +1 -1
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/crafter/environment.py +50 -17
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/crafter/policy.py +35 -21
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/crafter/react_agent.py +8 -4
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/crafter/shared.py +29 -26
- examples/warming_up_to_rl/task_app/synth_envs_hosted/envs/crafter/tools.py +1 -1
- examples/warming_up_to_rl/task_app/synth_envs_hosted/hosted_app.py +17 -13
- examples/warming_up_to_rl/task_app/synth_envs_hosted/inference/__init__.py +1 -1
- examples/warming_up_to_rl/task_app/synth_envs_hosted/inference/openai_client.py +106 -63
- examples/warming_up_to_rl/task_app/synth_envs_hosted/policy_routes.py +82 -84
- examples/warming_up_to_rl/task_app/synth_envs_hosted/rollout.py +76 -59
- examples/warming_up_to_rl/task_app/synth_envs_hosted/storage/__init__.py +1 -1
- examples/warming_up_to_rl/task_app/synth_envs_hosted/storage/volume.py +43 -49
- examples/warming_up_to_rl/task_app/synth_envs_hosted/test_service.py +5 -15
- synth_ai/__init__.py +1 -0
- synth_ai/api/train/builders.py +34 -10
- synth_ai/api/train/cli.py +172 -32
- synth_ai/api/train/config_finder.py +59 -4
- synth_ai/api/train/env_resolver.py +32 -14
- synth_ai/api/train/pollers.py +11 -3
- synth_ai/api/train/task_app.py +4 -1
- synth_ai/api/train/utils.py +20 -4
- synth_ai/cli/__init__.py +11 -4
- synth_ai/cli/balance.py +1 -1
- synth_ai/cli/demo.py +19 -5
- synth_ai/cli/rl_demo.py +75 -16
- synth_ai/cli/root.py +116 -37
- synth_ai/cli/task_apps.py +1286 -170
- synth_ai/cli/traces.py +1 -0
- synth_ai/cli/turso.py +73 -0
- synth_ai/core/experiment.py +0 -2
- synth_ai/demo_registry.py +67 -30
- synth_ai/demos/core/cli.py +493 -164
- synth_ai/demos/demo_task_apps/core.py +50 -6
- synth_ai/demos/demo_task_apps/crafter/configs/crafter_fft_4b.toml +2 -3
- synth_ai/demos/demo_task_apps/crafter/grpo_crafter_task_app.py +36 -28
- synth_ai/demos/demo_task_apps/math/_common.py +1 -2
- synth_ai/demos/demo_task_apps/math/deploy_modal.py +0 -2
- synth_ai/demos/demo_task_apps/math/modal_task_app.py +168 -65
- synth_ai/demos/demo_task_apps/math/task_app_entry.py +0 -1
- synth_ai/environments/examples/bandit/engine.py +12 -4
- synth_ai/environments/examples/bandit/taskset.py +4 -4
- synth_ai/environments/reproducibility/tree.py +3 -1
- synth_ai/environments/service/core_routes.py +6 -2
- synth_ai/evals/base.py +0 -2
- synth_ai/experimental/synth_oss.py +11 -12
- synth_ai/handshake.py +3 -1
- synth_ai/http_client.py +31 -7
- synth_ai/inference/__init__.py +0 -2
- synth_ai/inference/client.py +8 -4
- synth_ai/jobs/client.py +40 -10
- synth_ai/learning/client.py +33 -8
- synth_ai/learning/config.py +0 -2
- synth_ai/learning/constants.py +0 -2
- synth_ai/learning/ft_client.py +6 -3
- synth_ai/learning/health.py +9 -2
- synth_ai/learning/jobs.py +17 -5
- synth_ai/learning/prompts/hello_world_in_context_injection_ex.py +1 -3
- synth_ai/learning/prompts/random_search.py +4 -1
- synth_ai/learning/prompts/run_random_search_banking77.py +6 -1
- synth_ai/learning/rl_client.py +42 -14
- synth_ai/learning/sse.py +0 -2
- synth_ai/learning/validators.py +6 -2
- synth_ai/lm/caching/ephemeral.py +1 -3
- synth_ai/lm/core/exceptions.py +0 -2
- synth_ai/lm/core/main.py +13 -1
- synth_ai/lm/core/synth_models.py +0 -1
- synth_ai/lm/core/vendor_clients.py +4 -2
- synth_ai/lm/overrides.py +2 -2
- synth_ai/lm/vendors/core/anthropic_api.py +7 -7
- synth_ai/lm/vendors/core/openai_api.py +2 -0
- synth_ai/lm/vendors/openai_standard.py +3 -1
- synth_ai/lm/vendors/openai_standard_responses.py +6 -3
- synth_ai/lm/vendors/supported/custom_endpoint.py +1 -3
- synth_ai/lm/vendors/synth_client.py +37 -10
- synth_ai/rl/__init__.py +0 -1
- synth_ai/rl/contracts.py +0 -2
- synth_ai/rl/env_keys.py +6 -1
- synth_ai/task/__init__.py +1 -0
- synth_ai/task/apps/__init__.py +11 -11
- synth_ai/task/auth.py +29 -17
- synth_ai/task/client.py +3 -1
- synth_ai/task/contracts.py +1 -0
- synth_ai/task/datasets.py +3 -1
- synth_ai/task/errors.py +3 -2
- synth_ai/task/health.py +0 -2
- synth_ai/task/json.py +0 -1
- synth_ai/task/proxy.py +2 -5
- synth_ai/task/rubrics.py +9 -3
- synth_ai/task/server.py +31 -5
- synth_ai/task/tracing_utils.py +8 -3
- synth_ai/task/validators.py +0 -1
- synth_ai/task/vendors.py +0 -1
- synth_ai/tracing_v3/db_config.py +26 -1
- synth_ai/tracing_v3/decorators.py +1 -0
- synth_ai/tracing_v3/examples/basic_usage.py +3 -2
- synth_ai/tracing_v3/hooks.py +2 -0
- synth_ai/tracing_v3/replica_sync.py +1 -0
- synth_ai/tracing_v3/session_tracer.py +24 -3
- synth_ai/tracing_v3/storage/base.py +4 -1
- synth_ai/tracing_v3/storage/factory.py +0 -1
- synth_ai/tracing_v3/turso/manager.py +102 -38
- synth_ai/tracing_v3/turso/models.py +4 -1
- synth_ai/tracing_v3/utils.py +1 -0
- synth_ai/v0/tracing/upload.py +32 -135
- {synth_ai-0.2.9.dev4.dist-info → synth_ai-0.2.9.dev7.dist-info}/METADATA +1 -1
- {synth_ai-0.2.9.dev4.dist-info → synth_ai-0.2.9.dev7.dist-info}/RECORD +154 -156
- examples/warming_up_to_rl/task_app/synth_envs_hosted/test_stepwise_rewards.py +0 -58
- synth_ai/environments/examples/sokoban/units/astar_common.py +0 -95
- synth_ai/install_sqld.sh +0 -40
- {synth_ai-0.2.9.dev4.dist-info → synth_ai-0.2.9.dev7.dist-info}/WHEEL +0 -0
- {synth_ai-0.2.9.dev4.dist-info → synth_ai-0.2.9.dev7.dist-info}/entry_points.txt +0 -0
- {synth_ai-0.2.9.dev4.dist-info → synth_ai-0.2.9.dev7.dist-info}/licenses/LICENSE +0 -0
- {synth_ai-0.2.9.dev4.dist-info → synth_ai-0.2.9.dev7.dist-info}/top_level.txt +0 -0
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
astar_common.py – one A* routine usable by both engine-level and
|
|
3
|
-
environment-level unit tests.
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
import heapq
|
|
7
|
-
import itertools
|
|
8
|
-
import json
|
|
9
|
-
from typing import Any, Awaitable, Callable, List, Tuple
|
|
10
|
-
|
|
11
|
-
import numpy as np
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# ---------- generic utilities ------------------------------------ #
|
|
15
|
-
def _boxes_left(env_pkg) -> int:
|
|
16
|
-
"""#targets – #boxes-on-targets (uses raw grids, never the counter)."""
|
|
17
|
-
return int(np.sum(env_pkg.room_fixed == 2) - np.sum(env_pkg.room_state == 3))
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def solved(obj: Any) -> bool:
|
|
21
|
-
"""Expects obj to have a .package_sokoban_env attribute."""
|
|
22
|
-
return _boxes_left(obj.package_sokoban_env) == 0
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def heuristic(obj: Any) -> int:
|
|
26
|
-
"""Expects obj to have a .package_sokoban_env attribute."""
|
|
27
|
-
return _boxes_left(obj.package_sokoban_env)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# ---------- single reusable A* ----------------------------------- #
|
|
31
|
-
async def astar(
|
|
32
|
-
root_obj: Any,
|
|
33
|
-
step_fn: Callable[[Any, int], Awaitable[None]],
|
|
34
|
-
deserialize_fn: Callable[[Any], Awaitable[Any]],
|
|
35
|
-
max_nodes: int = 1000,
|
|
36
|
-
) -> List[int]:
|
|
37
|
-
"""
|
|
38
|
-
Generic A* over Sokoban snapshots.
|
|
39
|
-
|
|
40
|
-
• `root_obj` - current engine *or* environment
|
|
41
|
-
• `step_fn(obj, action)` - async: apply one move to *obj*
|
|
42
|
-
• `deserialize_fn(snapshot)` - async: new obj from snapshot
|
|
43
|
-
"""
|
|
44
|
-
start_snap = await root_obj._serialize_engine()
|
|
45
|
-
|
|
46
|
-
frontier: List[Tuple[int, int, Any, List[int]]] = []
|
|
47
|
-
counter = itertools.count()
|
|
48
|
-
frontier.append((heuristic(root_obj), next(counter), start_snap, []))
|
|
49
|
-
seen: set[str] = set()
|
|
50
|
-
|
|
51
|
-
nodes = 0
|
|
52
|
-
while frontier and nodes < max_nodes:
|
|
53
|
-
f, _, snap, path = heapq.heappop(frontier)
|
|
54
|
-
cur = await deserialize_fn(snap)
|
|
55
|
-
key = json.dumps(snap.engine_snapshot, sort_keys=True)
|
|
56
|
-
if key in seen:
|
|
57
|
-
continue
|
|
58
|
-
seen.add(key)
|
|
59
|
-
if solved(cur):
|
|
60
|
-
return path
|
|
61
|
-
|
|
62
|
-
nodes += 1
|
|
63
|
-
for action in range(cur.package_sokoban_env.action_space.n):
|
|
64
|
-
child = await deserialize_fn(snap) # fresh copy
|
|
65
|
-
try:
|
|
66
|
-
await step_fn(child, action)
|
|
67
|
-
except Exception: # illegal/off-board
|
|
68
|
-
continue
|
|
69
|
-
|
|
70
|
-
child_snap = await child._serialize_engine()
|
|
71
|
-
g = len(path) + 1
|
|
72
|
-
heapq.heappush(
|
|
73
|
-
frontier,
|
|
74
|
-
(g + heuristic(child), next(counter), child_snap, path + [action]),
|
|
75
|
-
)
|
|
76
|
-
return []
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
# convenience lambdas for the two concrete APIs
|
|
80
|
-
async def _engine_step(e, a): # `SokobanEngine`
|
|
81
|
-
await e._step_engine(a)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
async def _env_step(env, a): # `SokobanEnvironment` (expects Move wrapper)
|
|
85
|
-
from synth_ai.environments.examples.sokoban.units.test_sokoban_environment import Move
|
|
86
|
-
|
|
87
|
-
await env.step([[Move(a)]])
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
ENGINE_ASTAR = lambda eng, **kw: astar(eng, _engine_step, eng.__class__._deserialize_engine, **kw)
|
|
91
|
-
ENV_ASTAR = lambda env, **kw: astar(
|
|
92
|
-
env.engine, _env_step, env.engine.__class__._deserialize_engine, **kw
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
# ----------------------------------------------------------------- #
|
synth_ai/install_sqld.sh
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Install sqld binary for Synth AI
|
|
3
|
-
|
|
4
|
-
set -e
|
|
5
|
-
|
|
6
|
-
SQLD_VERSION="v0.26.2"
|
|
7
|
-
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
8
|
-
ARCH=$(uname -m)
|
|
9
|
-
|
|
10
|
-
# Map architecture names
|
|
11
|
-
case "$ARCH" in
|
|
12
|
-
x86_64) ARCH="x86_64" ;;
|
|
13
|
-
aarch64|arm64) ARCH="aarch64" ;;
|
|
14
|
-
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
|
|
15
|
-
esac
|
|
16
|
-
|
|
17
|
-
# Construct download URL
|
|
18
|
-
URL="https://github.com/tursodatabase/libsql/releases/download/libsql-server-${SQLD_VERSION}/sqld-${OS}-${ARCH}.tar.xz"
|
|
19
|
-
|
|
20
|
-
echo "📥 Downloading sqld ${SQLD_VERSION} for ${OS}-${ARCH}..."
|
|
21
|
-
|
|
22
|
-
# Download and extract
|
|
23
|
-
TMP_DIR=$(mktemp -d)
|
|
24
|
-
cd "$TMP_DIR"
|
|
25
|
-
curl -L -o sqld.tar.xz "$URL"
|
|
26
|
-
tar -xf sqld.tar.xz
|
|
27
|
-
|
|
28
|
-
# Install to user's local bin
|
|
29
|
-
mkdir -p ~/.local/bin
|
|
30
|
-
mv sqld ~/.local/bin/
|
|
31
|
-
chmod +x ~/.local/bin/sqld
|
|
32
|
-
|
|
33
|
-
# Clean up
|
|
34
|
-
cd -
|
|
35
|
-
rm -rf "$TMP_DIR"
|
|
36
|
-
|
|
37
|
-
echo "✅ sqld installed to ~/.local/bin/sqld"
|
|
38
|
-
echo ""
|
|
39
|
-
echo "🔧 Add ~/.local/bin to your PATH if needed:"
|
|
40
|
-
echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|