#!/bin/bash # Pack a trained checkpoint, measure it, check it, and build the demo files. # bash finalize.sh uses ckpt.pt # bash finalize.sh other.pt uses another checkpoint set -e cd "$(dirname "$0")" CK=${1:-ckpt.pt} python3 export.py "$CK" data/tok4096.json web/storyteller.bin python3 tests/bigval.py "$CK" web/storyteller.bin | tee bigval.txt VAL=$(awk '/^packed/{print $2}' bigval.txt) python3 export.py "$CK" data/tok4096.json web/storyteller.bin --val-loss "$VAL" # same bytes, with the measured loss noted in the header python3 tests/check_export.py web/storyteller.bin "$CK" node tests/check_engine.js web/storyteller.bin base64 -w0 web/storyteller.bin > web/storyteller.b64.txt python3 build.py