Skip to content

donaldfilimon/abi / .agents/skills/nn-demo

nn-demo

Verified

Build the abi CLI and run the miniature character-level neural-net demo — `nn train` (real manual-backprop char-LM) and `nn sample` (train-then-generate). Use to train, sample, or smoke-test the nn demo trainer, or verify nn after touching crates/abi-nn/. This is a demo trainer, NOT a production/LLM/distributed trainer.

FileKindSize
SKILL.mdskill md2.1 KB
nn.shexecutablescript1.7 KB
#!/usr/bin/env bash
# nn-demo driver: build the abi CLI and exercise the miniature character-level
# neural-net demo — `nn train` (real manual-backprop char-LM) and `nn sample`
# (train-then-generate). This is a DEMO trainer, not a production/LLM/distributed
# trainer. Asserts exit codes + output markers. Resolves repo root from own path.
#
# Usage: .agents/skills/nn-demo/nn.sh ["training corpus"] [seed-char] [n]
set -uo pipefail
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
REPO_ROOT=$(cd -- "$SCRIPT_DIR/../../.." && pwd)
cd "$REPO_ROOT"
ABI="$REPO_ROOT/target/debug/abi"
CORPUS="${1:-the quick brown fox jumps over the lazy dog the quick brown fox}"
SEED="${2:-t}"
N="${3:-20}"
fail=0
say() { printf '\n=== %s ===\n' "$*"; }
markers() { local out="$1"; shift; for m in "$@"; do
    grep -qF -- "$m" <<<"$out" && echo "[ok] marker: $m" \
        || { echo "[FAIL] missing marker: $m"; fail=$((fail+1)); }; done; }

say "build cli"
./tools/cargo.sh build -p abi-cli >/dev/null 2>&1 && echo "[ok] build" || { echo "[FAIL] build"; exit 1; }
[ -x "$ABI" ] || { echo "[FAIL] $ABI not produced"; exit 1; }

say "abi nn train"
out=$("$ABI" nn train "$CORPUS" 2>&1); rc=$?
printf '%s\n' "$out"
[ "$rc" -eq 0 ] || { echo "[FAIL] nn train exit $rc"; fail=$((fail+1)); }
markers "$out" "nn train:" "final_loss=" "steps="

say "abi nn sample"
out=$("$ABI" nn sample --text "$CORPUS" --seed "$SEED" --n "$N" 2>&1); rc=$?
printf '%s\n' "$out"
[ "$rc" -eq 0 ] || { echo "[FAIL] nn sample exit $rc"; fail=$((fail+1)); }
markers "$out" "nn sample:"

say "summary"; echo "failed checks: $fail"
[ "$fail" -eq 0 ] && echo "RESULT: PASS — nn demo trains + samples." || echo "RESULT: FAIL — $fail check(s)."
exit "$fail"
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall