#!/usr/bin/env bash # End-to-end demonstration: license a real, LoRA-carried model capability, # gate its use, and cryptographically revoke it. Runs steps 1-7 in order and # stops on the first failure. # # Prerequisites (one-time): # python3 -m venv .venv-demo # . .venv-demo/bin/activate # pip install -r requirements-demo.txt # # A CUDA GPU is recommended (the reference run used an RTX 4090). CPU works but # training and evaluation are much slower. set -euo pipefail cd "$(dirname "$0")" if [ -x ".venv-demo/bin/python" ]; then PYTHON="${PYTHON:-.venv-demo/bin/python}" else PYTHON="${PYTHON:-python3}" fi if ! "$PYTHON" -c "import torch, transformers, peft" 2>/dev/null; then echo "The demo dependencies are not installed for: $PYTHON" echo "Run: python3 -m venv .venv-demo && . .venv-demo/bin/activate && pip install -r requirements-demo.txt" exit 1 fi echo "==================================================================" echo " Capability licensing: real end-to-end model-capability demo" echo " python: $($PYTHON -c 'import sys; print(sys.version.split()[0])')" echo " device: $($PYTHON -c 'import torch; print(torch.cuda.get_device_name(0) if torch.cuda.is_available() else "cpu")')" echo "==================================================================" for step in \ demo/01_download_base.py \ demo/02_eval_base.py \ demo/03_train_lora.py \ demo/04_eval_lora.py \ demo/05_package_unit.py \ demo/06_serve_licensed.py \ demo/07_revoke_erase.py do echo echo "------------------------------------------------------------------" "$PYTHON" "$step" done echo echo "==================================================================" echo " END-TO-END DEMO COMPLETE" echo " Base could not do C; the LoRA taught it; the adapter was sealed," echo " licensed, served, revoked, and crypto-erased. The escaped copy is" echo " inert and the base alone still cannot do C." echo "=================================================================="