File size: 1,290 Bytes
385fc44 | 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 | #!/usr/bin/env bash
# test.sh - Test harness for the exported Micro Distillery model.
set -euo pipefail
cd "$(dirname "$0")"
PY="${PYTHON:-python3}"
echo "================================================"
echo " Micro Distillery - Model Test Harness"
echo "================================================"
echo ""
if ! command -v "$PY" >/dev/null 2>&1; then
echo "ERROR: $PY not found. Install Python 3.8+." >&2
echo " macOS: brew install python3" >&2
echo " Ubuntu: sudo apt install python3" >&2
echo " Windows: https://python.org/downloads/" >&2
exit 1
fi
echo "[1/3] Python: $($PY --version 2>&1)"
if [ ! -f model.json ]; then
echo "ERROR: model.json not found in $(pwd)" >&2
exit 1
fi
echo "[2/3] Found model.json"
$PY -c "
import json
m = json.load(open('model.json'))
assert 'transitions' in m, 'missing transitions'
assert 'vocab' in m, 'missing vocab'
print('OK: format=%s vocab=%d transitions=%d' % (m.get('format','?'), len(m['vocab']), len(m['transitions'])))
"
echo "[3/3] Model validation passed"
echo ""
echo "=== Sample Generations ==="
for prompt in alice bob zoe liam; do
echo -n " $prompt -> "
$PY test.py "$prompt" 2>/dev/null | tail -1 || echo "(failed)"
done
echo ""
echo "=== Interactive Chat (type /quit to exit) ==="
exec $PY test.py
|