BHARGAV REDDY commited on
Commit
e0d3d11
Β·
verified Β·
1 Parent(s): ae83544

Upload setup_and_train_300m.sh with huggingface_hub

Browse files
Files changed (1) hide show
  1. 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 -c "
67
  from pathlib import Path
68
  import json
69
- data_dir = Path('$DATA_DIR')
70
- index_path = data_dir / 'index.json'
 
 
71
  if not index_path.exists():
72
- candidates = sorted(data_dir.glob('**/index.json'))
73
  if candidates:
74
- print('ERROR: index.json still not at dataset root after fetch.')
75
- print('Found candidates:')
76
  for candidate in candidates[:10]:
77
- print(f' - {candidate}')
78
  else:
79
- print(f'ERROR: No index.json found under {data_dir}')
80
  raise SystemExit(1)
81
- with open(index_path, encoding='utf-8') as f:
 
82
  idx = json.load(f)
83
- total = sum(c.get('dim', 0) for c in idx.get('chunks', []))
84
- print(f' Dataset ready: {len(idx.get("chunks", []))} chunks, {total:,} tokens at {index_path}')
85
- "
 
 
86
 
87
  # ── 3. System probe ──────────────────────────────────────────────────────────
88
  echo ""
89
  echo "[3/5] System probe..."
90
- python -c "
91
- import torch, psutil, os
 
 
 
92
  props = torch.cuda.get_device_properties(0) if torch.cuda.is_available() else None
93
- print(f' GPU : {props.name if props else \"CPU only\"} ({props.total_memory/1024**3:.1f} GB)' if props else ' GPU: None')
94
- print(f' RAM : {psutil.virtual_memory().total/1024**3:.1f} GB')
95
- print(f' CPUs : {os.cpu_count()}')
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 ""