simcheongi / examples /lora_tiny.sh
koreashin's picture
코드 추가: 추론·학습·LoRA 어댑터 (simcheongi 패키지, 문서, 예제, 시험)
025ab09 verified
Raw History Blame Contribute Delete
1.16 kB
#!/usr/bin/env bash
# Tiny LoRA run on a SYNTHETIC dataset: train -> adapter -> load / merge -> evaluate (pipeline check).
# bash examples/lora_tiny.sh [MODEL] [WORKDIR]
set -euo pipefail
cd "$(dirname "$0")/.."
MODEL=${1:-koreashin/simcheongi}
WORK=${2:-./_tiny_runs}
DEVICE=${DEVICE:-cuda}
python tools/make_fake_dataset.py --out "$WORK/fake_bc" --episodes 4 --decisions 12 --val-episodes 1
python train_lora.py --init "$MODEL" --data "$WORK/fake_bc" --out "$WORK/lora_tiny" --device "$DEVICE" \
--steps 20 --batch 2 --lr 2e-4 --warmup 2 --workers 2 --log-every 1 --save-every 0 --keep-every 0 \
--lora-rank 16 --lora-alpha 16
python merge_lora.py --base "$MODEL" --adapter "$WORK/lora_tiny/final" --out "$WORK/lora_tiny_merged"
python eval_offline.py --model "$MODEL" --data "$WORK/fake_bc" --split train --device "$DEVICE"
python eval_offline.py --model "$MODEL" --adapter "$WORK/lora_tiny/final" --data "$WORK/fake_bc" --split train --device "$DEVICE"
python eval_offline.py --model "$WORK/lora_tiny_merged" --data "$WORK/fake_bc" --split train --device "$DEVICE"
echo "adapter: $WORK/lora_tiny/final merged model: $WORK/lora_tiny_merged"