-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
57 lines (48 loc) · 1.58 KB
/
docker-entrypoint.sh
File metadata and controls
57 lines (48 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
set -e
# Execute the agent function and capture the output
# We'll use environment variables to configure the agent
# - AGENT_TYPE: The type of agent to run (simple, memory)
# - EPISODES: Number of episodes to run
# - SEED: Random seed for reproducibility
# Default to a debug run if no args specified
if [ "$AGENT_TYPE" == "memory" ]; then
echo "Running memory-enhanced agent..."
MEMORY_ENABLED="True"
else
echo "Running simple agent..."
MEMORY_ENABLED="False"
fi
# Default values
EPISODES=${EPISODES:-10}
SEED=${SEED:-42}
# Run the agent experiment and save results to output file
echo "Starting experiment with $EPISODES episodes, memory_enabled=$MEMORY_ENABLED, seed=$SEED"
python -c "
import json
import sys
from main_demo import run_debug_experiment
import numpy as np
# Configure NumPy to use a specific random seed for reproducibility
np.random.seed($SEED)
# Run the experiment
results = run_debug_experiment(episodes=$EPISODES, memory_enabled=$MEMORY_ENABLED, random_seed=$SEED)
# Convert NumPy types to Python types for JSON serialization
def convert_numpy(obj):
if isinstance(obj, np.integer):
return int(obj)
elif isinstance(obj, np.floating):
return float(obj)
elif isinstance(obj, np.ndarray):
return obj.tolist()
elif isinstance(obj, dict):
return {k: convert_numpy(v) for k, v in obj.items()}
elif isinstance(obj, list):
return [convert_numpy(item) for item in obj]
else:
return obj
# Print results to stdout
print(json.dumps(convert_numpy(results), indent=2))
"
# Exit with success
exit 0