Scriptwriter dataset sync
Browse files- restart-train.sh +22 -26
- scriptwriter-runpod-ready.tgz +2 -2
restart-train.sh
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
#!/bin/bash
|
|
|
|
| 2 |
# curl -fsSL "https://huggingface.co/datasets/datamatters24/scriptwriter-runpod/resolve/main/restart-train.sh" | bash
|
| 3 |
set -euo pipefail
|
| 4 |
|
|
@@ -18,9 +19,6 @@ rm -rf "$DEST"
|
|
| 18 |
mkdir -p "$DEST"
|
| 19 |
tar xzf "$TGZ" -C "$DEST" --strip-components=1 --no-same-owner --no-same-permissions
|
| 20 |
|
| 21 |
-
NPROC="$(python3 -c 'import torch; print(torch.cuda.device_count())' 2>/dev/null || echo 2)"
|
| 22 |
-
if [[ "${NPROC}" -lt 1 ]]; then NPROC=1; fi
|
| 23 |
-
|
| 24 |
export WORKDIR="$DEST"
|
| 25 |
export DATA_DIR=/workspace/data/processed
|
| 26 |
export OUTPUT_DIR=/workspace/models/lora
|
|
@@ -28,15 +26,13 @@ export HF_DATASET_REPO="${HF_DATASET_REPO:-datamatters24/scriptwriter-corpus-ia}
|
|
| 28 |
export HF_MODEL_REPO="${HF_MODEL_REPO:-datamatters24/scriptwriter-lora-ia}"
|
| 29 |
export BASE_MODEL="${BASE_MODEL:-meta-llama/Llama-3.2-3B-Instruct}"
|
| 30 |
export RUNPOD_SKIP_FORCE_PIP=1
|
| 31 |
-
|
| 32 |
export MAX_SEQ_LENGTH=2048
|
| 33 |
export MAX_SEQ_LENGTH_CAP=2048
|
| 34 |
export PER_DEVICE_TRAIN_BATCH_SIZE=1
|
| 35 |
-
export GRADIENT_ACCUMULATION_STEPS=
|
| 36 |
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
|
| 37 |
-
|
| 38 |
-
export RESUME_FROM_CHECKPOINT=0
|
| 39 |
-
export NPROC_PER_NODE="${NPROC}"
|
| 40 |
|
| 41 |
if [[ ! -f /workspace/data/processed/train.jsonl ]]; then
|
| 42 |
echo "train.jsonl missing — use fix-and-train.sh instead"
|
|
@@ -51,33 +47,33 @@ ln -sfn /workspace/data/processed "$DEST/data/processed"
|
|
| 51 |
apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq tmux >/dev/null || true
|
| 52 |
|
| 53 |
WORKER=/workspace/logs/_train_worker.sh
|
| 54 |
-
cat > "$WORKER" <<INNER
|
| 55 |
#!/bin/bash
|
| 56 |
set -euo pipefail
|
| 57 |
cd /workspace/scriptwriter-runpod
|
| 58 |
-
export HF_TOKEN="
|
| 59 |
-
export HUGGING_FACE_HUB_TOKEN="
|
| 60 |
-
export HF_HOME="
|
| 61 |
export CONFIG_PATH=/workspace/scriptwriter-runpod/config/training.yaml
|
| 62 |
-
export BASE_MODEL="
|
| 63 |
export OUTPUT_DIR=/workspace/models/lora
|
| 64 |
-
export HF_MODEL_REPO="
|
| 65 |
-
|
| 66 |
export MAX_SEQ_LENGTH=2048
|
| 67 |
export MAX_SEQ_LENGTH_CAP=2048
|
| 68 |
export PER_DEVICE_TRAIN_BATCH_SIZE=1
|
| 69 |
-
export GRADIENT_ACCUMULATION_STEPS=
|
| 70 |
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
|
| 71 |
-
export RESUME_FROM_CHECKPOINT=
|
| 72 |
-
NPROC=${NPROC}
|
| 73 |
exec > >(tee -a /workspace/logs/train_live.log) 2>&1
|
| 74 |
-
echo "========== TRAIN START
|
| 75 |
-
echo "
|
|
|
|
| 76 |
nvidia-smi || true
|
| 77 |
-
|
| 78 |
-
echo "========== UPLOAD
|
| 79 |
-
python3 scripts/sync_hf.py upload-model --repo "
|
| 80 |
-
echo "========== DONE
|
| 81 |
echo "STOP THE POD"
|
| 82 |
INNER
|
| 83 |
chmod +x "$WORKER"
|
|
@@ -85,5 +81,5 @@ chmod +x "$WORKER"
|
|
| 85 |
tmux new-session -d -s scriptwriter-train -n train "bash $WORKER"
|
| 86 |
tmux new-window -t scriptwriter-train -n monitor
|
| 87 |
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
|
| 88 |
-
echo "Started
|
| 89 |
-
echo "
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
+
# Stable single-GPU restart (DDP SIGABRT'd on this pod).
|
| 3 |
# curl -fsSL "https://huggingface.co/datasets/datamatters24/scriptwriter-runpod/resolve/main/restart-train.sh" | bash
|
| 4 |
set -euo pipefail
|
| 5 |
|
|
|
|
| 19 |
mkdir -p "$DEST"
|
| 20 |
tar xzf "$TGZ" -C "$DEST" --strip-components=1 --no-same-owner --no-same-permissions
|
| 21 |
|
|
|
|
|
|
|
|
|
|
| 22 |
export WORKDIR="$DEST"
|
| 23 |
export DATA_DIR=/workspace/data/processed
|
| 24 |
export OUTPUT_DIR=/workspace/models/lora
|
|
|
|
| 26 |
export HF_MODEL_REPO="${HF_MODEL_REPO:-datamatters24/scriptwriter-lora-ia}"
|
| 27 |
export BASE_MODEL="${BASE_MODEL:-meta-llama/Llama-3.2-3B-Instruct}"
|
| 28 |
export RUNPOD_SKIP_FORCE_PIP=1
|
| 29 |
+
export CUDA_VISIBLE_DEVICES=0
|
| 30 |
export MAX_SEQ_LENGTH=2048
|
| 31 |
export MAX_SEQ_LENGTH_CAP=2048
|
| 32 |
export PER_DEVICE_TRAIN_BATCH_SIZE=1
|
| 33 |
+
export GRADIENT_ACCUMULATION_STEPS=8
|
| 34 |
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
|
| 35 |
+
export RESUME_FROM_CHECKPOINT="${RESUME_FROM_CHECKPOINT:-1}"
|
|
|
|
|
|
|
| 36 |
|
| 37 |
if [[ ! -f /workspace/data/processed/train.jsonl ]]; then
|
| 38 |
echo "train.jsonl missing — use fix-and-train.sh instead"
|
|
|
|
| 47 |
apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq tmux >/dev/null || true
|
| 48 |
|
| 49 |
WORKER=/workspace/logs/_train_worker.sh
|
| 50 |
+
cat > "$WORKER" <<'INNER'
|
| 51 |
#!/bin/bash
|
| 52 |
set -euo pipefail
|
| 53 |
cd /workspace/scriptwriter-runpod
|
| 54 |
+
export HF_TOKEN="${HF_TOKEN:-}"
|
| 55 |
+
export HUGGING_FACE_HUB_TOKEN="${HF_TOKEN:-}"
|
| 56 |
+
export HF_HOME="${HF_HOME:-/workspace/.cache/huggingface}"
|
| 57 |
export CONFIG_PATH=/workspace/scriptwriter-runpod/config/training.yaml
|
| 58 |
+
export BASE_MODEL="${BASE_MODEL:-meta-llama/Llama-3.2-3B-Instruct}"
|
| 59 |
export OUTPUT_DIR=/workspace/models/lora
|
| 60 |
+
export HF_MODEL_REPO="${HF_MODEL_REPO:-datamatters24/scriptwriter-lora-ia}"
|
| 61 |
+
export CUDA_VISIBLE_DEVICES=0
|
| 62 |
export MAX_SEQ_LENGTH=2048
|
| 63 |
export MAX_SEQ_LENGTH_CAP=2048
|
| 64 |
export PER_DEVICE_TRAIN_BATCH_SIZE=1
|
| 65 |
+
export GRADIENT_ACCUMULATION_STEPS=8
|
| 66 |
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
|
| 67 |
+
export RESUME_FROM_CHECKPOINT="${RESUME_FROM_CHECKPOINT:-1}"
|
|
|
|
| 68 |
exec > >(tee -a /workspace/logs/train_live.log) 2>&1
|
| 69 |
+
echo "========== TRAIN START $(date -Is) =========="
|
| 70 |
+
echo "STABLE 1-GPU: seq=2048 batch=1 accum=8 (DDP disabled — prior SIGABRT)"
|
| 71 |
+
ls /workspace/models/lora/checkpoint-* 2>/dev/null | tail -5 || echo "no prior checkpoint"
|
| 72 |
nvidia-smi || true
|
| 73 |
+
python3 scripts/train_runpod.py
|
| 74 |
+
echo "========== UPLOAD $(date -Is) =========="
|
| 75 |
+
python3 scripts/sync_hf.py upload-model --repo "$HF_MODEL_REPO" --folder /workspace/models/lora
|
| 76 |
+
echo "========== DONE $(date -Is) =========="
|
| 77 |
echo "STOP THE POD"
|
| 78 |
INNER
|
| 79 |
chmod +x "$WORKER"
|
|
|
|
| 81 |
tmux new-session -d -s scriptwriter-train -n train "bash $WORKER"
|
| 82 |
tmux new-window -t scriptwriter-train -n monitor
|
| 83 |
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
|
| 84 |
+
echo "Started STABLE 1-GPU train — attach: tmux attach -t scriptwriter-train"
|
| 85 |
+
echo "GPU 1 idle is expected. Resume checkpoint 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:51834db8130e7a45b215ed86659c79db7b44b8336eee0f22b3aac5bcf01e2c40
|
| 3 |
+
size 10116
|