Files
Athena-Deck/docs/experiments/deepseek-iq2-2026-10-24/acquire.sh
T

34 lines
1.9 KiB
Bash

#!/bin/sh
# Native reproducible preparation; never launches a model or touches Deck.
set -eu
task_source_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
task_destination=${1:?Usage: acquire.sh /absolute/new/experiment-directory}
case "$task_destination" in /*) ;; *) echo 'Use an absolute destination.' >&2; exit 2;; esac
if [ -e "$task_destination" ]; then
echo 'Destination already exists; inspect its status and resume prepare.py instead.' >&2
exit 2
fi
for task_program in python3 git aria2c; do command -v "$task_program" >/dev/null; done
mkdir -p "$task_destination/models"
cp "$task_source_dir/prepare.py" "$task_source_dir/measure.py" "$task_source_dir/mock_tools.py" \
"$task_source_dir/cases.json" "$task_source_dir/weights-manifest.json" "$task_destination/"
git clone --depth 1 --branch v0.2.4 https://github.com/Niko1221/Strata.git "$task_destination/source"
test "$(git -C "$task_destination/source" rev-parse HEAD)" = 96ca4383c7b05a8a3e6064c65d9e9977d4b3bb59
python3 - "$task_destination" <<'PY'
import json, shutil, sys
from pathlib import Path
base=Path(sys.argv[1]);m=json.loads((base/'weights-manifest.json').read_text())
if shutil.disk_usage(base).free < m['total_bytes'] + 10_000_000_000:
raise SystemExit('Need at least model download size plus 10 GB free. Nothing is deleted.')
lines=[]
for f in m['files']:
lines += [f"https://huggingface.co/{f['repo']}/resolve/{f['revision']}/{f['path']}",
f" dir={base/'models'}",f" out={f['name']}",f" checksum=sha-256={f['sha256']}"]
(base/'weights.aria2').write_text('\n'.join(lines)+'\n')
PY
python3 -m venv "$task_destination/venv"
"$task_destination/venv/bin/python" -m pip install --disable-pip-version-check -r "$task_destination/source/requirements.txt"
"$task_destination/venv/bin/python" -m pip freeze >"$task_destination/python-lock.txt"
printf 'ready\n' >"$task_destination/python-ready.txt"
exec python3 "$task_destination/prepare.py" "$task_destination"