datamatters24 commited on
Commit
a221eb4
·
verified ·
1 Parent(s): 8527f38

Scriptwriter dataset sync

Browse files
Files changed (2) hide show
  1. fix-and-train.sh +58 -0
  2. scriptwriter-runpod-ready.tgz +2 -2
fix-and-train.sh ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Fix broken peft/transformers import on RunPod, then restart training.
3
+ # curl -fsSL "https://huggingface.co/datasets/datamatters24/scriptwriter-runpod/resolve/main/fix-and-train.sh" | bash
4
+ set -euo pipefail
5
+
6
+ echo "=== Killing old train session (if any) ==="
7
+ tmux kill-session -t scriptwriter-train 2>/dev/null || true
8
+ pkill -f 'train_runpod.py' 2>/dev/null || true
9
+
10
+ echo "=== Installing pinned deps (fixes NameError: torch is not defined) ==="
11
+ python3 -m pip install -q --upgrade pip
12
+ python3 -m pip uninstall -y transformers peft trl accelerate 2>/dev/null || true
13
+ python3 -m pip install -q --force-reinstall \
14
+ "transformers==4.46.3" \
15
+ "peft==0.13.2" \
16
+ "trl==0.12.1" \
17
+ "accelerate==0.34.2" \
18
+ "datasets>=2.19.0,<3.1" \
19
+ "huggingface_hub>=0.24.0,<0.30" \
20
+ "safetensors>=0.4.0"
21
+
22
+ python3 - <<'PY'
23
+ import torch, transformers, peft, trl
24
+ print("torch", torch.__version__, "cuda", torch.cuda.is_available(), "gpus", torch.cuda.device_count())
25
+ print("transformers", transformers.__version__)
26
+ print("peft", peft.__version__)
27
+ print("trl", trl.__version__)
28
+ from peft import LoraConfig
29
+ from transformers import AutoTokenizer
30
+ print("imports ok")
31
+ PY
32
+
33
+ # Refresh trainer scripts from public bundle (has tmux install + pins)
34
+ DEST=/workspace/scriptwriter-runpod
35
+ TGZ=/tmp/scriptwriter-runpod-ready.tgz
36
+ curl -fsSL "https://huggingface.co/datasets/datamatters24/scriptwriter-runpod/resolve/main/scriptwriter-runpod-ready.tgz" -o "$TGZ"
37
+ rm -rf "$DEST"
38
+ mkdir -p "$DEST"
39
+ tar xzf "$TGZ" -C "$DEST" --strip-components=1 --no-same-owner --no-same-permissions
40
+
41
+ export WORKDIR="$DEST"
42
+ export DATA_DIR=/workspace/data/processed
43
+ export OUTPUT_DIR=/workspace/models/lora
44
+ export HF_DATASET_REPO="${HF_DATASET_REPO:-datamatters24/scriptwriter-corpus-ia}"
45
+ export HF_MODEL_REPO="${HF_MODEL_REPO:-datamatters24/scriptwriter-lora-ia}"
46
+ export BASE_MODEL="${BASE_MODEL:-meta-llama/Llama-3.2-3B-Instruct}"
47
+
48
+ # Skip re-download noise: train.jsonl already present
49
+ if [[ ! -f /workspace/data/processed/train.jsonl ]]; then
50
+ echo "ERROR: /workspace/data/processed/train.jsonl missing"
51
+ exit 1
52
+ fi
53
+
54
+ cd "$DEST"
55
+ # Soft-patch: comment out dataset download section by setting SKIP flag the script understands
56
+ # If not present, just run — re-download is fine/fast from cache
57
+ export SKIP_DATASET_DOWNLOAD=1
58
+ bash scripts/runpod_train_tmux.sh
scriptwriter-runpod-ready.tgz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:bd03262170595bc25822e85d4cfab058933d242119479cfda03df7199fe5fd5b
3
- size 7193
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c5a76a9a5e7e1689b963d6f66a0e24ad61d834808380f6ddbb72d7328da3a0b
3
+ size 7992