Compare commits
2 Commits
fbc7a50f34
...
6c34df103e
| Author | SHA1 | Date | |
|---|---|---|---|
|
6c34df103e
|
|||
|
af7df92f4d
|
+1
-3
@@ -5,12 +5,10 @@
|
||||
.vscode
|
||||
.venv/
|
||||
__pycache__/
|
||||
data/
|
||||
.env
|
||||
.tools/
|
||||
.testing/
|
||||
|
||||
dbschema/migrations/
|
||||
|
||||
*.jsonl
|
||||
/dataset/
|
||||
models/
|
||||
|
||||
+19
-4
@@ -1,10 +1,26 @@
|
||||
# Stage 1 — compile sqlite-zstd against the container's own SQLite
|
||||
FROM ghcr.io/astral-sh/uv:python3.13-trixie-slim AS sqlite-zstd-builder
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
curl git libsqlite3-dev libzstd-dev pkg-config build-essential ca-certificates && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal
|
||||
ENV PATH="/root/.cargo/bin:${PATH}"
|
||||
|
||||
RUN git clone --depth=1 --branch v0.3.5 https://github.com/phiresky/sqlite-zstd.git /tmp/sqlite-zstd && \
|
||||
cd /tmp/sqlite-zstd && \
|
||||
cargo build --release --features build_extension && \
|
||||
cp target/release/libsqlite_zstd.so /usr/local/lib/libsqlite_zstd.so
|
||||
|
||||
# Stage 2 — runtime image
|
||||
FROM ghcr.io/astral-sh/uv:python3.13-trixie-slim
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends curl libzstd1 && \
|
||||
curl -fsSL "https://github.com/phiresky/sqlite-zstd/releases/download/v0.3.5/sqlite_zstd-v0.3.5-x86_64-unknown-linux-gnu.tar.gz" \
|
||||
| tar -xz --strip-components=1 -C /usr/local/lib "sqlite_zstd-v0.3.5-x86_64-unknown-linux-gnu/libsqlite_zstd.so" && \
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends libzstd1 && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=sqlite-zstd-builder /usr/local/lib/libsqlite_zstd.so /usr/local/lib/libsqlite_zstd.so
|
||||
|
||||
# Install app
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
@@ -12,7 +28,6 @@ WORKDIR /app
|
||||
# Install dependencies
|
||||
RUN uv sync --no-config --frozen --compile-bytecode
|
||||
|
||||
# Starten Sie Ihre Anwendung
|
||||
EXPOSE 8000
|
||||
|
||||
CMD [".venv/bin/hypercorn", "asgi:app", "--bind", "0.0.0.0:8000", "--workers", "1", "--access-logfile", "-"]
|
||||
|
||||
@@ -12,8 +12,8 @@ set dotenv-required := true
|
||||
# Use zsh
|
||||
set shell := ["bash", "-cu"]
|
||||
|
||||
BATTLESNAKE_CLI_DIR := ".tools/battlesnake-cli"
|
||||
BATTLESNAKE_CLI_BIN := ".tools/battlesnake-cli/battlesnake"
|
||||
BATTLESNAKE_CLI_DIR := ".testing/tools/battlesnake-cli"
|
||||
BATTLESNAKE_CLI_BIN := ".testing/tools/battlesnake-cli/battlesnake"
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Default
|
||||
@@ -112,7 +112,7 @@ test-local-4 mode="standard" map="standard" base_port="9101" snake="BestBattleSn
|
||||
set -euo pipefail
|
||||
|
||||
BATTLESNAKE_CLI="{{justfile_directory()}}/{{BATTLESNAKE_CLI_BIN}}"
|
||||
LOG_DIR="{{justfile_directory()}}/.tools/snake-logs"
|
||||
LOG_DIR="{{justfile_directory()}}/.testing/tools/snake-logs"
|
||||
mkdir -p "$LOG_DIR"
|
||||
|
||||
pids=()
|
||||
@@ -162,17 +162,17 @@ test-local-4 mode="standard" map="standard" base_port="9101" snake="BestBattleSn
|
||||
# Dataset helpers
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
export-dataset input="data" output="data/dataset/good_moves.jsonl":
|
||||
export-dataset input=".testing/data" output=".testing/data/dataset/good_moves.jsonl":
|
||||
python -m server.DatasetExporter --input "{{input}}" --output "{{output}}"
|
||||
|
||||
curate-dataset input="good_moves-*.jsonl" output="data/dataset/best_moves.jsonl" min_turn="6" late_turn="20" max_safe_options="2" min_score="3" append="false" archive="false" archive_dir="":
|
||||
curate-dataset input="good_moves-*.jsonl" output=".testing/data/dataset/best_moves.jsonl" min_turn="6" late_turn="20" max_safe_options="2" min_score="3" append="false" archive="false" archive_dir="":
|
||||
FLAGS=""; if [ "{{append}}" = "true" ]; then FLAGS="$FLAGS --append"; fi; if [ "{{archive}}" = "true" ]; then FLAGS="$FLAGS --archive-input"; fi; if [ -n "{{archive_dir}}" ]; then FLAGS="$FLAGS --archive-dir {{archive_dir}}"; fi; python -m server.DatasetCurator --input "{{input}}" --output "{{output}}" --min-turn "{{min_turn}}" --late-turn "{{late_turn}}" --max-safe-options "{{max_safe_options}}" --min-score "{{min_score}}" $FLAGS
|
||||
|
||||
analyze-dataset input="good_moves-*.jsonl" output="":
|
||||
if [ -n "{{output}}" ]; then python -m server.DatasetStats --input "{{input}}" --output "{{output}}"; else python -m server.DatasetStats --input "{{input}}"; fi
|
||||
|
||||
train-ai input="dataset/best_moves.jsonl" rl_input="dataset/rl_bootstrap.jsonl" output="models/battlesnake_softmax_v2.json" eval_split="0.2" seed="42" epochs="14" lr="0.08":
|
||||
train-ai input=".testing/data/dataset/best_moves.jsonl" rl_input=".testing/data/dataset/rl_bootstrap.jsonl" output=".testing/models/battlesnake_softmax_v2.json" eval_split="0.2" seed="42" epochs="14" lr="0.08":
|
||||
if [ -f "{{rl_input}}" ]; then python -m server.TrainBattleSnakeAI --input "{{input}}" --input "{{rl_input}}" --output "{{output}}" --eval-split "{{eval_split}}" --seed "{{seed}}" --epochs "{{epochs}}" --lr "{{lr}}"; else python -m server.TrainBattleSnakeAI --input "{{input}}" --output "{{output}}" --eval-split "{{eval_split}}" --seed "{{seed}}" --epochs "{{epochs}}" --lr "{{lr}}"; fi
|
||||
|
||||
run-trained model="models/battlesnake_softmax_v2.json" port="8000":
|
||||
run-trained model=".testing/models/battlesnake_softmax_v2.json" port="8000":
|
||||
TRAINED_SNAKE_MODEL="{{model}}" SNAKE="TrainedBattleSnake" PORT="{{port}}" "{{justfile_directory()}}/main.py"
|
||||
|
||||
Reference in New Issue
Block a user