From 87e2b14bbddf808d594c16dd5debd1d3550be243 Mon Sep 17 00:00:00 2001 From: Cedric Date: Fri, 24 Apr 2026 13:11:23 +0000 Subject: [PATCH] feat: gui in devcontainer and simulate folder --- .devcontainer/devcontainer.json | 4 +++- simulate_folder.sh | 42 +++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100755 simulate_folder.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 623526f..da7cf6e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -34,7 +34,9 @@ }, "remoteUser": "vscode", "runArgs": [ - "--device", "nvidia.com/gpu=all" + "--device", "nvidia.com/gpu=all", + "--env=DISPLAY=${localEnv:DISPLAY}", + "--volume=/tmp/.X11-unix:/tmp/.X11-unix" ], // Ensure the .venv persists using a named volume for performance and parity "mounts": [ diff --git a/simulate_folder.sh b/simulate_folder.sh new file mode 100755 index 0000000..c08bffc --- /dev/null +++ b/simulate_folder.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Usage: ./simulate_folder.sh /path/to/runs + +BASE_DIR="${1:?Usage: $0 /path/to/runs}" + +for run_dir in "$BASE_DIR"/*/; do + echo "======================================" + echo "Processing: $run_dir" + + # Find model and config files (first match in folder) + flax_file=$(find "$run_dir" -maxdepth 1 -type f -name "*.flax" | head -n 1) + yaml_file=$(find "$run_dir" -maxdepth 1 -type f -name "*.yaml" | head -n 1) + + # Safety checks + if [[ -z "${flax_file:-}" ]]; then + echo "❌ No .flax file found in $run_dir, skipping." + continue + fi + + if [[ -z "${yaml_file:-}" ]]; then + echo "❌ No .yaml file found in $run_dir, skipping." + continue + fi + + echo "Using model: $flax_file" + echo "Using config: $yaml_file" + + output_file="$run_dir/simulation_output.log" + + echo "Running simulation..." + + uv run python scripts/simulate.py \ + simulation.model_path="$flax_file" \ + simulation.trained_config_path="$yaml_file" \ + simulation.headless=True \ + simulation.max_steps=5000 \ + > "$output_file" 2>&1 + + echo "Saved output to: $output_file" +done \ No newline at end of file