mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 22:33:42 +00:00
chore(training): Track training artifacts in git, add idempotent Linux setup/run scripts, and commit run01 results
This commit is contained in:
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
# Idempotent setup for a Linux training box — safe to re-run at any time;
|
||||
# every step checks before it acts. See TRAINING_LINUX.md.
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
GODOT_VERSION="4.7.1"
|
||||
GODOT_BIN="${GODOT_BIN:-$HOME/ai-training/godot/Godot_v${GODOT_VERSION}-stable_linux.x86_64}"
|
||||
|
||||
# Godot binary
|
||||
if [ ! -x "$GODOT_BIN" ]; then
|
||||
echo "Downloading Godot $GODOT_VERSION to $(dirname "$GODOT_BIN")"
|
||||
mkdir -p "$(dirname "$GODOT_BIN")"
|
||||
wget -q "https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}-stable/Godot_v${GODOT_VERSION}-stable_linux.x86_64.zip" \
|
||||
-O /tmp/godot_dl.zip
|
||||
unzip -o -q /tmp/godot_dl.zip -d "$(dirname "$GODOT_BIN")"
|
||||
rm /tmp/godot_dl.zip
|
||||
chmod +x "$GODOT_BIN"
|
||||
fi
|
||||
echo "Godot: $GODOT_BIN"
|
||||
|
||||
# Python env
|
||||
[ -d .venv ] || python3 -m venv .venv
|
||||
.venv/bin/pip install -q -r requirements.txt
|
||||
|
||||
# CUDA check; pip's default torch is CUDA-enabled on Linux, but fall back to
|
||||
# the explicit CUDA index if this box ended up with a CPU-only build
|
||||
if [ "$(.venv/bin/python -c 'import torch; print(torch.cuda.is_available())')" != "True" ]; then
|
||||
echo "CUDA not available — reinstalling torch from the CUDA wheel index"
|
||||
.venv/bin/pip install -q torch --index-url https://download.pytorch.org/whl/cu121
|
||||
fi
|
||||
|
||||
# Import pass — a fresh clone has no .godot/ cache, so class_name scripts
|
||||
# (GameMode, Goal, …) aren't registered and scenes fail to load until the
|
||||
# project is imported once. Cheap when the cache already exists.
|
||||
"$GODOT_BIN" --headless --path ../Game --import
|
||||
|
||||
# Headless smoke test — the game must boot without rendering
|
||||
"$GODOT_BIN" --headless --path ../Game res://scenes/free_play.tscn --quit-after 300
|
||||
|
||||
echo "Setup OK — train with: ./run_training.sh <experiment> [train.py args...]"
|
||||
Reference in New Issue
Block a user