BHARGAV REDDY commited on
Upload setup_and_train_300m.sh with huggingface_hub
Browse files- setup_and_train_300m.sh +29 -18
setup_and_train_300m.sh
CHANGED
|
@@ -63,37 +63,48 @@ else
|
|
| 63 |
exit 1
|
| 64 |
fi
|
| 65 |
|
| 66 |
-
python -
|
| 67 |
from pathlib import Path
|
| 68 |
import json
|
| 69 |
-
|
| 70 |
-
|
|
|
|
|
|
|
| 71 |
if not index_path.exists():
|
| 72 |
-
candidates = sorted(data_dir.glob(
|
| 73 |
if candidates:
|
| 74 |
-
print(
|
| 75 |
-
print(
|
| 76 |
for candidate in candidates[:10]:
|
| 77 |
-
print(f
|
| 78 |
else:
|
| 79 |
-
print(f
|
| 80 |
raise SystemExit(1)
|
| 81 |
-
|
|
|
|
| 82 |
idx = json.load(f)
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
"
|
|
|
|
|
|
|
| 86 |
|
| 87 |
# ββ 3. System probe ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 88 |
echo ""
|
| 89 |
echo "[3/5] System probe..."
|
| 90 |
-
python -
|
| 91 |
-
import
|
|
|
|
|
|
|
|
|
|
| 92 |
props = torch.cuda.get_device_properties(0) if torch.cuda.is_available() else None
|
| 93 |
-
|
| 94 |
-
print(f
|
| 95 |
-
|
| 96 |
-
"
|
|
|
|
|
|
|
|
|
|
| 97 |
|
| 98 |
# ββ 4. Pretrain (with validation every 100 steps) βββββββββββββββββββββββββββββ
|
| 99 |
echo ""
|
|
|
|
| 63 |
exit 1
|
| 64 |
fi
|
| 65 |
|
| 66 |
+
DATA_DIR_ENV="$DATA_DIR" python - <<'PYEOF'
|
| 67 |
from pathlib import Path
|
| 68 |
import json
|
| 69 |
+
import os
|
| 70 |
+
|
| 71 |
+
data_dir = Path(os.environ["DATA_DIR_ENV"])
|
| 72 |
+
index_path = data_dir / "index.json"
|
| 73 |
if not index_path.exists():
|
| 74 |
+
candidates = sorted(data_dir.glob("**/index.json"))
|
| 75 |
if candidates:
|
| 76 |
+
print("ERROR: index.json still not at dataset root after fetch.")
|
| 77 |
+
print("Found candidates:")
|
| 78 |
for candidate in candidates[:10]:
|
| 79 |
+
print(f" - {candidate}")
|
| 80 |
else:
|
| 81 |
+
print(f"ERROR: No index.json found under {data_dir}")
|
| 82 |
raise SystemExit(1)
|
| 83 |
+
|
| 84 |
+
with open(index_path, encoding="utf-8") as f:
|
| 85 |
idx = json.load(f)
|
| 86 |
+
|
| 87 |
+
chunks = idx.get("chunks", [])
|
| 88 |
+
total = sum(c.get("dim", 0) for c in chunks)
|
| 89 |
+
print(f" Dataset ready: {len(chunks)} chunks, {total:,} tokens at {index_path}")
|
| 90 |
+
PYEOF
|
| 91 |
|
| 92 |
# ββ 3. System probe ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 93 |
echo ""
|
| 94 |
echo "[3/5] System probe..."
|
| 95 |
+
python - <<'PYEOF'
|
| 96 |
+
import os
|
| 97 |
+
import psutil
|
| 98 |
+
import torch
|
| 99 |
+
|
| 100 |
props = torch.cuda.get_device_properties(0) if torch.cuda.is_available() else None
|
| 101 |
+
if props:
|
| 102 |
+
print(f" GPU : {props.name} ({props.total_memory / 1024**3:.1f} GB)")
|
| 103 |
+
else:
|
| 104 |
+
print(" GPU: None")
|
| 105 |
+
print(f" RAM : {psutil.virtual_memory().total / 1024**3:.1f} GB")
|
| 106 |
+
print(f" CPUs : {os.cpu_count()}")
|
| 107 |
+
PYEOF
|
| 108 |
|
| 109 |
# ββ 4. Pretrain (with validation every 100 steps) βββββββββββββββββββββββββββββ
|
| 110 |
echo ""
|