synth-ai 0.2.4.dev3__py3-none-any.whl → 0.2.4.dev5__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.
- synth_ai/environments/examples/__init__.py +1 -0
- synth_ai/environments/examples/crafter_classic/__init__.py +8 -0
- synth_ai/environments/examples/crafter_classic/config_logging.py +111 -0
- synth_ai/environments/examples/crafter_classic/debug_translation.py +0 -0
- synth_ai/environments/examples/crafter_classic/engine.py +575 -0
- synth_ai/environments/examples/crafter_classic/engine_deterministic_patch.py +63 -0
- synth_ai/environments/examples/crafter_classic/engine_helpers/action_map.py +5 -0
- synth_ai/environments/examples/crafter_classic/engine_helpers/serialization.py +74 -0
- synth_ai/environments/examples/crafter_classic/engine_serialization_patch_v3.py +266 -0
- synth_ai/environments/examples/crafter_classic/environment.py +364 -0
- synth_ai/environments/examples/crafter_classic/taskset.py +233 -0
- synth_ai/environments/examples/crafter_classic/trace_hooks_v3.py +229 -0
- synth_ai/environments/examples/crafter_classic/world_config_patch_simple.py +298 -0
- synth_ai/environments/examples/crafter_custom/__init__.py +4 -0
- synth_ai/environments/examples/crafter_custom/crafter/__init__.py +7 -0
- synth_ai/environments/examples/crafter_custom/crafter/config.py +182 -0
- synth_ai/environments/examples/crafter_custom/crafter/constants.py +8 -0
- synth_ai/environments/examples/crafter_custom/crafter/engine.py +269 -0
- synth_ai/environments/examples/crafter_custom/crafter/env.py +266 -0
- synth_ai/environments/examples/crafter_custom/crafter/objects.py +418 -0
- synth_ai/environments/examples/crafter_custom/crafter/recorder.py +187 -0
- synth_ai/environments/examples/crafter_custom/crafter/worldgen.py +119 -0
- synth_ai/environments/examples/crafter_custom/dataset_builder.py +373 -0
- synth_ai/environments/examples/crafter_custom/environment.py +312 -0
- synth_ai/environments/examples/crafter_custom/run_dataset.py +305 -0
- synth_ai/environments/examples/enron/art_helpers/email_search_tools.py +156 -0
- synth_ai/environments/examples/enron/art_helpers/local_email_db.py +280 -0
- synth_ai/environments/examples/enron/art_helpers/types_enron.py +24 -0
- synth_ai/environments/examples/enron/engine.py +291 -0
- synth_ai/environments/examples/enron/environment.py +165 -0
- synth_ai/environments/examples/enron/taskset.py +112 -0
- synth_ai/environments/examples/minigrid/__init__.py +48 -0
- synth_ai/environments/examples/minigrid/engine.py +589 -0
- synth_ai/environments/examples/minigrid/environment.py +274 -0
- synth_ai/environments/examples/minigrid/environment_mapping.py +242 -0
- synth_ai/environments/examples/minigrid/puzzle_loader.py +416 -0
- synth_ai/environments/examples/minigrid/taskset.py +583 -0
- synth_ai/environments/examples/nethack/__init__.py +7 -0
- synth_ai/environments/examples/nethack/achievements.py +337 -0
- synth_ai/environments/examples/nethack/engine.py +738 -0
- synth_ai/environments/examples/nethack/environment.py +255 -0
- synth_ai/environments/examples/nethack/helpers/__init__.py +42 -0
- synth_ai/environments/examples/nethack/helpers/action_mapping.py +301 -0
- synth_ai/environments/examples/nethack/helpers/nle_wrapper.py +401 -0
- synth_ai/environments/examples/nethack/helpers/observation_utils.py +433 -0
- synth_ai/environments/examples/nethack/helpers/recording_wrapper.py +201 -0
- synth_ai/environments/examples/nethack/helpers/trajectory_recorder.py +268 -0
- synth_ai/environments/examples/nethack/helpers/visualization/replay_viewer.py +308 -0
- synth_ai/environments/examples/nethack/helpers/visualization/visualizer.py +430 -0
- synth_ai/environments/examples/nethack/taskset.py +323 -0
- synth_ai/environments/examples/red/__init__.py +7 -0
- synth_ai/environments/examples/red/config_logging.py +110 -0
- synth_ai/environments/examples/red/engine.py +693 -0
- synth_ai/environments/examples/red/engine_helpers/__init__.py +1 -0
- synth_ai/environments/examples/red/engine_helpers/memory_map.py +28 -0
- synth_ai/environments/examples/red/engine_helpers/reward_components.py +275 -0
- synth_ai/environments/examples/red/engine_helpers/reward_library/__init__.py +142 -0
- synth_ai/environments/examples/red/engine_helpers/reward_library/adaptive_rewards.py +56 -0
- synth_ai/environments/examples/red/engine_helpers/reward_library/battle_rewards.py +283 -0
- synth_ai/environments/examples/red/engine_helpers/reward_library/composite_rewards.py +149 -0
- synth_ai/environments/examples/red/engine_helpers/reward_library/economy_rewards.py +137 -0
- synth_ai/environments/examples/red/engine_helpers/reward_library/efficiency_rewards.py +56 -0
- synth_ai/environments/examples/red/engine_helpers/reward_library/exploration_rewards.py +330 -0
- synth_ai/environments/examples/red/engine_helpers/reward_library/novelty_rewards.py +120 -0
- synth_ai/environments/examples/red/engine_helpers/reward_library/pallet_town_rewards.py +558 -0
- synth_ai/environments/examples/red/engine_helpers/reward_library/pokemon_rewards.py +312 -0
- synth_ai/environments/examples/red/engine_helpers/reward_library/social_rewards.py +147 -0
- synth_ai/environments/examples/red/engine_helpers/reward_library/story_rewards.py +246 -0
- synth_ai/environments/examples/red/engine_helpers/screen_analysis.py +367 -0
- synth_ai/environments/examples/red/engine_helpers/state_extraction.py +139 -0
- synth_ai/environments/examples/red/environment.py +235 -0
- synth_ai/environments/examples/red/taskset.py +77 -0
- synth_ai/environments/examples/sokoban/__init__.py +1 -0
- synth_ai/environments/examples/sokoban/engine.py +675 -0
- synth_ai/environments/examples/sokoban/engine_helpers/__init__.py +1 -0
- synth_ai/environments/examples/sokoban/engine_helpers/room_utils.py +656 -0
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/__init__.py +17 -0
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/__init__.py +3 -0
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/boxoban_env.py +129 -0
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/render_utils.py +370 -0
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/room_utils.py +331 -0
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/sokoban_env.py +305 -0
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/sokoban_env_fixed_targets.py +66 -0
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/sokoban_env_pull.py +114 -0
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/sokoban_env_two_player.py +122 -0
- synth_ai/environments/examples/sokoban/engine_helpers/vendored/envs/sokoban_env_variations.py +394 -0
- synth_ai/environments/examples/sokoban/environment.py +228 -0
- synth_ai/environments/examples/sokoban/generate_verified_puzzles.py +438 -0
- synth_ai/environments/examples/sokoban/puzzle_loader.py +311 -0
- synth_ai/environments/examples/sokoban/taskset.py +425 -0
- synth_ai/environments/examples/tictactoe/__init__.py +1 -0
- synth_ai/environments/examples/tictactoe/engine.py +368 -0
- synth_ai/environments/examples/tictactoe/environment.py +239 -0
- synth_ai/environments/examples/tictactoe/taskset.py +214 -0
- synth_ai/environments/examples/verilog/__init__.py +10 -0
- synth_ai/environments/examples/verilog/engine.py +328 -0
- synth_ai/environments/examples/verilog/environment.py +349 -0
- synth_ai/environments/examples/verilog/taskset.py +418 -0
- synth_ai/tracing_v3/examples/basic_usage.py +188 -0
- {synth_ai-0.2.4.dev3.dist-info → synth_ai-0.2.4.dev5.dist-info}/METADATA +1 -1
- {synth_ai-0.2.4.dev3.dist-info → synth_ai-0.2.4.dev5.dist-info}/RECORD +105 -6
- {synth_ai-0.2.4.dev3.dist-info → synth_ai-0.2.4.dev5.dist-info}/WHEEL +0 -0
- {synth_ai-0.2.4.dev3.dist-info → synth_ai-0.2.4.dev5.dist-info}/entry_points.txt +0 -0
- {synth_ai-0.2.4.dev3.dist-info → synth_ai-0.2.4.dev5.dist-info}/licenses/LICENSE +0 -0
- {synth_ai-0.2.4.dev3.dist-info → synth_ai-0.2.4.dev5.dist-info}/top_level.txt +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
"""Environment examples and demos."""
|
@@ -0,0 +1,8 @@
|
|
1
|
+
from .config_logging import configure_logging
|
2
|
+
from .environment import CrafterClassicEnvironment
|
3
|
+
from .engine import CrafterEngine
|
4
|
+
|
5
|
+
# Configure logging when crafter_classic module is imported
|
6
|
+
configure_logging()
|
7
|
+
|
8
|
+
__all__ = ["CrafterClassicEnvironment", "CrafterEngine"]
|
@@ -0,0 +1,111 @@
|
|
1
|
+
"""
|
2
|
+
Logging configuration for Craftax environment.
|
3
|
+
Suppresses obnoxious JAX debug messages and sets appropriate log levels.
|
4
|
+
"""
|
5
|
+
|
6
|
+
import logging
|
7
|
+
import os
|
8
|
+
import warnings
|
9
|
+
|
10
|
+
|
11
|
+
def configure_logging():
|
12
|
+
"""Configure logging to suppress noisy debug messages."""
|
13
|
+
|
14
|
+
# Suppress JAX debug logging by setting appropriate log levels
|
15
|
+
jax_loggers = [
|
16
|
+
"jax._src.cache_key",
|
17
|
+
"jax._src.compilation_cache",
|
18
|
+
"jax._src.compiler",
|
19
|
+
"jax._src.dispatch",
|
20
|
+
"jax",
|
21
|
+
"jaxlib",
|
22
|
+
]
|
23
|
+
|
24
|
+
for logger_name in jax_loggers:
|
25
|
+
logger = logging.getLogger(logger_name)
|
26
|
+
logger.setLevel(logging.WARNING)
|
27
|
+
logger.propagate = False
|
28
|
+
|
29
|
+
# Set JAX platform to CPU to avoid GPU-related logging
|
30
|
+
os.environ.setdefault("JAX_PLATFORMS", "cpu")
|
31
|
+
|
32
|
+
# Suppress JAX warnings and compilation messages
|
33
|
+
os.environ.setdefault("JAX_ENABLE_X64", "False")
|
34
|
+
os.environ.setdefault("JAX_LOG_COMPILES", "0")
|
35
|
+
os.environ.setdefault("JAX_COMPILATION_CACHE_DIR", "/tmp/jax_cache")
|
36
|
+
|
37
|
+
# Configure root logger to INFO level (but don't override if already configured)
|
38
|
+
if not logging.getLogger().handlers:
|
39
|
+
logging.basicConfig(level=logging.INFO, format="%(levelname)s:%(name)s:%(message)s")
|
40
|
+
|
41
|
+
# Suppress other noisy libraries
|
42
|
+
logging.getLogger("matplotlib").setLevel(logging.WARNING)
|
43
|
+
logging.getLogger("PIL").setLevel(logging.WARNING)
|
44
|
+
logging.getLogger("urllib3").setLevel(logging.WARNING)
|
45
|
+
|
46
|
+
# Filter out specific warnings
|
47
|
+
warnings.filterwarnings("ignore", category=UserWarning, module="jax")
|
48
|
+
warnings.filterwarnings("ignore", category=FutureWarning, module="jax")
|
49
|
+
|
50
|
+
|
51
|
+
def safe_compare(left, right, operation="<"):
|
52
|
+
"""
|
53
|
+
Safely compare two values, handling string vs int comparison errors.
|
54
|
+
|
55
|
+
Args:
|
56
|
+
left: Left operand
|
57
|
+
right: Right operand
|
58
|
+
operation: Comparison operation ('>', '<', '>=', '<=', '==', '!=')
|
59
|
+
|
60
|
+
Returns:
|
61
|
+
bool: Result of comparison, or False if types are incompatible
|
62
|
+
"""
|
63
|
+
try:
|
64
|
+
# If both are strings, try to convert to numbers
|
65
|
+
if isinstance(left, str) and isinstance(right, str):
|
66
|
+
try:
|
67
|
+
left = float(left)
|
68
|
+
right = float(right)
|
69
|
+
except ValueError:
|
70
|
+
# If conversion fails, compare as strings
|
71
|
+
pass
|
72
|
+
# If one is string and one is number, try to convert string to number
|
73
|
+
elif isinstance(left, str) and isinstance(right, (int, float)):
|
74
|
+
try:
|
75
|
+
left = type(right)(left)
|
76
|
+
except ValueError:
|
77
|
+
logging.warning(f"Cannot compare string '{left}' with number {right}")
|
78
|
+
return False
|
79
|
+
elif isinstance(left, (int, float)) and isinstance(right, str):
|
80
|
+
try:
|
81
|
+
right = type(left)(right)
|
82
|
+
except ValueError:
|
83
|
+
logging.warning(f"Cannot compare number {left} with string '{right}'")
|
84
|
+
return False
|
85
|
+
|
86
|
+
# Perform the comparison
|
87
|
+
if operation == "<":
|
88
|
+
return left < right
|
89
|
+
elif operation == ">":
|
90
|
+
return left > right
|
91
|
+
elif operation == "<=":
|
92
|
+
return left <= right
|
93
|
+
elif operation == ">=":
|
94
|
+
return left >= right
|
95
|
+
elif operation == "==":
|
96
|
+
return left == right
|
97
|
+
elif operation == "!=":
|
98
|
+
return left != right
|
99
|
+
else:
|
100
|
+
raise ValueError(f"Unsupported operation: {operation}")
|
101
|
+
|
102
|
+
except TypeError as e:
|
103
|
+
logging.error(f"Type error in comparison: {left} {operation} {right} - {e}")
|
104
|
+
return False
|
105
|
+
except Exception as e:
|
106
|
+
logging.error(f"Unexpected error in comparison: {left} {operation} {right} - {e}")
|
107
|
+
return False
|
108
|
+
|
109
|
+
|
110
|
+
# Configure logging when module is imported
|
111
|
+
configure_logging()
|
File without changes
|