Scriptwriter dataset sync
Browse files- restart-train.sh +16 -17
- scriptwriter-runpod-ready.tgz +2 -2
restart-train.sh
CHANGED
|
@@ -3,20 +3,12 @@
|
|
| 3 |
set -euo pipefail
|
| 4 |
|
| 5 |
echo "=== Force-stopping old training ==="
|
| 6 |
-
# Kill tmux session hard
|
| 7 |
tmux kill-session -t scriptwriter-train 2>/dev/null || true
|
| 8 |
tmux kill-server 2>/dev/null || true
|
| 9 |
-
# Kill any leftover trainers / python
|
| 10 |
pkill -9 -f 'train_runpod.py' 2>/dev/null || true
|
| 11 |
pkill -9 -f 'scripts/train_runpod' 2>/dev/null || true
|
| 12 |
sleep 2
|
| 13 |
-
|
| 14 |
-
if pgrep -af 'train_runpod' >/dev/null 2>&1; then
|
| 15 |
-
echo "WARNING: train process still alive:"
|
| 16 |
-
pgrep -af 'train_runpod' || true
|
| 17 |
-
pkill -9 -f train_runpod || true
|
| 18 |
-
sleep 1
|
| 19 |
-
fi
|
| 20 |
echo "Old session cleared."
|
| 21 |
|
| 22 |
DEST=/workspace/scriptwriter-runpod
|
|
@@ -33,19 +25,20 @@ export HF_DATASET_REPO="${HF_DATASET_REPO:-datamatters24/scriptwriter-corpus-ia}
|
|
| 33 |
export HF_MODEL_REPO="${HF_MODEL_REPO:-datamatters24/scriptwriter-lora-ia}"
|
| 34 |
export BASE_MODEL="${BASE_MODEL:-meta-llama/Llama-3.2-3B-Instruct}"
|
| 35 |
export RUNPOD_SKIP_FORCE_PIP=1
|
| 36 |
-
export
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
if [[ ! -f /workspace/data/processed/train.jsonl ]]; then
|
| 39 |
echo "train.jsonl missing — use fix-and-train.sh instead"
|
| 40 |
exit 1
|
| 41 |
fi
|
| 42 |
|
| 43 |
-
# Skip heavy pip in runpod_train_tmux by marking skip
|
| 44 |
cd "$DEST"
|
| 45 |
-
# Patch: run worker directly to avoid re-download delays
|
| 46 |
mkdir -p /workspace/logs /workspace/models/lora
|
| 47 |
-
LOG=/workspace/logs/train_$(date +%Y%m%d_%H%M%S).log
|
| 48 |
-
# Ensure ROOT data symlink
|
| 49 |
mkdir -p "$DEST/data"
|
| 50 |
ln -sfn /workspace/data/processed "$DEST/data/processed"
|
| 51 |
|
|
@@ -63,9 +56,16 @@ export CONFIG_PATH=/workspace/scriptwriter-runpod/config/training.yaml
|
|
| 63 |
export BASE_MODEL="${BASE_MODEL:-meta-llama/Llama-3.2-3B-Instruct}"
|
| 64 |
export OUTPUT_DIR=/workspace/models/lora
|
| 65 |
export HF_MODEL_REPO="${HF_MODEL_REPO:-datamatters24/scriptwriter-lora-ia}"
|
| 66 |
-
export
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
exec > >(tee -a /workspace/logs/train_live.log) 2>&1
|
| 68 |
echo "========== TRAIN START $(date -Is) =========="
|
|
|
|
|
|
|
| 69 |
nvidia-smi || true
|
| 70 |
python3 scripts/train_runpod.py
|
| 71 |
echo "========== UPLOAD $(date -Is) =========="
|
|
@@ -73,11 +73,10 @@ python3 scripts/sync_hf.py upload-model --repo "$HF_MODEL_REPO" --folder /worksp
|
|
| 73 |
echo "========== DONE $(date -Is) =========="
|
| 74 |
echo "STOP THE POD"
|
| 75 |
INNER
|
| 76 |
-
# rewrite worker with expanded log path - the heredoc above uses train_live.log which is fine
|
| 77 |
chmod +x "$WORKER"
|
| 78 |
|
| 79 |
-
tmux has-session -t scriptwriter-train 2>/dev/null && tmux kill-session -t scriptwriter-train || true
|
| 80 |
tmux new-session -d -s scriptwriter-train -n train "bash $WORKER"
|
| 81 |
tmux new-window -t scriptwriter-train -n monitor
|
| 82 |
tmux send-keys -t scriptwriter-train:monitor "watch -n 15 'nvidia-smi --query-gpu=index,memory.used,utilization.gpu --format=csv; echo; tail -25 /workspace/logs/train_live.log'" Enter
|
| 83 |
echo "Started tmux scriptwriter-train — attach: tmux attach -t scriptwriter-train"
|
|
|
|
|
|
| 3 |
set -euo pipefail
|
| 4 |
|
| 5 |
echo "=== Force-stopping old training ==="
|
|
|
|
| 6 |
tmux kill-session -t scriptwriter-train 2>/dev/null || true
|
| 7 |
tmux kill-server 2>/dev/null || true
|
|
|
|
| 8 |
pkill -9 -f 'train_runpod.py' 2>/dev/null || true
|
| 9 |
pkill -9 -f 'scripts/train_runpod' 2>/dev/null || true
|
| 10 |
sleep 2
|
| 11 |
+
pgrep -af 'train_runpod' >/dev/null 2>&1 && pkill -9 -f train_runpod || true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
echo "Old session cleared."
|
| 13 |
|
| 14 |
DEST=/workspace/scriptwriter-runpod
|
|
|
|
| 25 |
export HF_MODEL_REPO="${HF_MODEL_REPO:-datamatters24/scriptwriter-lora-ia}"
|
| 26 |
export BASE_MODEL="${BASE_MODEL:-meta-llama/Llama-3.2-3B-Instruct}"
|
| 27 |
export RUNPOD_SKIP_FORCE_PIP=1
|
| 28 |
+
export MAX_SEQ_LENGTH=2048
|
| 29 |
+
export MAX_SEQ_LENGTH_CAP=2048
|
| 30 |
+
export PER_DEVICE_TRAIN_BATCH_SIZE=1
|
| 31 |
+
export GRADIENT_ACCUMULATION_STEPS=8
|
| 32 |
+
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
|
| 33 |
+
export RESUME_FROM_CHECKPOINT=1
|
| 34 |
|
| 35 |
if [[ ! -f /workspace/data/processed/train.jsonl ]]; then
|
| 36 |
echo "train.jsonl missing — use fix-and-train.sh instead"
|
| 37 |
exit 1
|
| 38 |
fi
|
| 39 |
|
|
|
|
| 40 |
cd "$DEST"
|
|
|
|
| 41 |
mkdir -p /workspace/logs /workspace/models/lora
|
|
|
|
|
|
|
| 42 |
mkdir -p "$DEST/data"
|
| 43 |
ln -sfn /workspace/data/processed "$DEST/data/processed"
|
| 44 |
|
|
|
|
| 56 |
export BASE_MODEL="${BASE_MODEL:-meta-llama/Llama-3.2-3B-Instruct}"
|
| 57 |
export OUTPUT_DIR=/workspace/models/lora
|
| 58 |
export HF_MODEL_REPO="${HF_MODEL_REPO:-datamatters24/scriptwriter-lora-ia}"
|
| 59 |
+
export MAX_SEQ_LENGTH=2048
|
| 60 |
+
export MAX_SEQ_LENGTH_CAP=2048
|
| 61 |
+
export PER_DEVICE_TRAIN_BATCH_SIZE=1
|
| 62 |
+
export GRADIENT_ACCUMULATION_STEPS=8
|
| 63 |
+
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
|
| 64 |
+
export RESUME_FROM_CHECKPOINT=1
|
| 65 |
exec > >(tee -a /workspace/logs/train_live.log) 2>&1
|
| 66 |
echo "========== TRAIN START $(date -Is) =========="
|
| 67 |
+
echo "OOM-safe: seq=2048 batch=1 accum=8 gpu0-only + checkpointing"
|
| 68 |
+
ls /workspace/models/lora/checkpoint-* 2>/dev/null | tail -5 || echo "no prior checkpoint"
|
| 69 |
nvidia-smi || true
|
| 70 |
python3 scripts/train_runpod.py
|
| 71 |
echo "========== UPLOAD $(date -Is) =========="
|
|
|
|
| 73 |
echo "========== DONE $(date -Is) =========="
|
| 74 |
echo "STOP THE POD"
|
| 75 |
INNER
|
|
|
|
| 76 |
chmod +x "$WORKER"
|
| 77 |
|
|
|
|
| 78 |
tmux new-session -d -s scriptwriter-train -n train "bash $WORKER"
|
| 79 |
tmux new-window -t scriptwriter-train -n monitor
|
| 80 |
tmux send-keys -t scriptwriter-train:monitor "watch -n 15 'nvidia-smi --query-gpu=index,memory.used,utilization.gpu --format=csv; echo; tail -25 /workspace/logs/train_live.log'" Enter
|
| 81 |
echo "Started tmux scriptwriter-train — attach: tmux attach -t scriptwriter-train"
|
| 82 |
+
echo "OOM fix: 2048 tokens, batch 1, gradient checkpointing; resumes checkpoint-100 if present"
|
scriptwriter-runpod-ready.tgz
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4746d83e090484c84c0ec1d60401c872a0c25a7e6990fae6eec9bf4b836df63c
|
| 3 |
+
size 10052
|