Upload runners/RUN_QUAD_5090_MASTER_SFT_V3.txt with huggingface_hub
Browse files63 unmodified lines6465666768697071727374757677787980818283848586878889902 unmodified lines939495969798991 unmodified line1011021031041051061071081091 unmodified line1111121131141151161176 unmodified lines1241251261271281291301 unmodified line13213313413513613713811 unmodified lines15015115215315415515663 unmodified linesbase_ckpt_path = "checkpoints/ckpt_latest.pt"# Robust broken symlink & corrupt checkpoint cleanerif os.path.islink(base_ckpt_path) or os.path.lexists(base_ckpt_path):try:os.unlink(base_ckpt_path)print("🧹 Removed previous broken checkpoint file/symlink.")except Exception:try:os.remove(base_ckpt_path)except Exception:passneed_download = Trueif os.path.exists(base_ckpt_path) and not os.path.islink(base_ckpt_path):try:if os.path.getsize(base_ckpt_path) >= 5 * 1024**3:need_download = Falseexcept Exception:passif need_download:print(f"\n📥 Downloading Healthy Base Checkpoint from {REPO_ID} (ckpt_latest.pt, ~5.6 GB)...")if os.path.exists(base_ckpt_path) or os.path.islink(base_ckpt_path) or os.path.lexists(base_ckpt_path):try:os.unlink(base_ckpt_path)except Exception:2 unmodified linesprint(f"✅ Base Checkpoint Ready: {base_ckpt_path} ({os.path.getsize(base_ckpt_path)/(1024**3):.2f} GB)")# 4. Check / Download Master SFT v3 Shards (Verified 266,537 Train Samples)needed_shards = ["train_tokens.npy", "train_labels.npy", "train_offsets.npy", "train_domains.npy","val_tokens.npy", "val_labels.npy", "val_offsets.npy", "val_domains.npy",1 unmodified line]target_data_folder = "tokenized_data/sft_v3"train_offsets_file = os.path.join(target_data_folder, "train_offsets.npy")EXPECTED_TRAIN_SAMPLES = 266537# Auto-detect outdated shards (e.g. cached 225k samples) or broken filesif os.path.exists(train_offsets_file):try:import numpy as np1 unmodified linecached_count = len(offsets) - 1if cached_count != EXPECTED_TRAIN_SAMPLES:print(f"⚠️ Detected cached outdated SFT shards ({cached_count:,} vs expected {EXPECTED_TRAIN_SAMPLES:,} samples).")print(f"🧹 Auto-clearing {target_data_folder} to fetch fresh 266k shards...")shutil.rmtree(target_data_folder, ignore_errors=True)except Exception as e:print(f"⚠️ Shard validation error ({e}). Re-fetching...")6 unmodified linestry: os.unlink(dst)except Exception: passif not os.path.exists(dst):print(f" ⬇️ Fetching {fname} (Fresh 266k dataset)...")dl = hf_hub_download(repo_id=TOKENIZED_DATA_REPO, filename=f"sft_v3/{fname}", repo_type="dataset", token=HF_TOKEN, force_download=True)real_src = os.path.realpath(dl)src_to_copy = real_src if os.path.exists(real_src) else dl1 unmodified linetry: os.unlink(dst)except Exception: passshutil.copyfile(src_to_copy, dst)print(f"✅ Master SFT v3 Gold Dataset Ready in {target_data_folder} (Verified {EXPECTED_TRAIN_SAMPLES:,} Train Samples)!")# 5. Launch 4-GPU DDP via Python distributed module (100% environment safe)print("\n" + "=" * 85)11 unmodified lines"--init_ckpt", base_ckpt_path,"--batch_size", "8","--grad_accum", "4","--epochs", "3","--max_lr", "3.0e-5","--min_lr", "2.0e-6","--neftune_alpha", "1.0",63 unmodified lines6465666768697071727374757677787980818283848586878889909192939495962 unmodified lines991001011021031041051 unmodified line1071081091101111121131141151 unmodified line1171181191201211221236 unmodified lines1301311321331341351361 unmodified line13813914014114214314411 unmodified lines15615715815916016116263 unmodified linesbase_ckpt_path = "checkpoints/ckpt_latest.pt"# Robust broken symlink & corrupt checkpoint cleaneris_valid_ckpt = Falseif os.path.islink(base_ckpt_path):print("🧹 Removing symlink checkpoint to replace with standalone real file...")try:os.unlink(base_ckpt_path)except Exception:passelif os.path.lexists(base_ckpt_path) and not os.path.exists(base_ckpt_path):print("🧹 Removing broken/dangling symlink...")try:os.remove(base_ckpt_path)except Exception:passelif os.path.exists(base_ckpt_path):try:if os.path.getsize(base_ckpt_path) >= 5 * 1024**3:is_valid_ckpt = Trueprint(f"✅ Existing Valid Base Checkpoint Found ({os.path.getsize(base_ckpt_path)/(1024**3):.2f} GB). Skipping download!")else:print("⚠️ Corrupt/incomplete checkpoint detected, removing...")os.remove(base_ckpt_path)except Exception:passif not is_valid_ckpt:print(f"\n📥 Downloading Healthy Base Checkpoint from {REPO_ID} (ckpt_latest.pt, ~5.6 GB)...")if os.path.islink(base_ckpt_path) or os.path.lexists(base_ckpt_path):try:os.unlink(base_ckpt_path)except Exception:2 unmodified linesprint(f"✅ Base Checkpoint Ready: {base_ckpt_path} ({os.path.getsize(base_ckpt_path)/(1024**3):.2f} GB)")# 4. Check / Download Master SFT v3 Shards (Verified 1M / 961,274 Train Samples)needed_shards = ["train_tokens.npy", "train_labels.npy", "train_offsets.npy", "train_domains.npy","val_tokens.npy", "val_labels.npy", "val_offsets.npy", "val_domains.npy",1 unmodified line]target_data_folder = "tokenized_data/sft_v3"train_offsets_file = os.path.join(target_data_folder, "train_offsets.npy")EXPECTED_TRAIN_SAMPLES = 961274# Auto-detect outdated shards (e.g. cached 225k/266k samples) or broken filesif os.path.exists(train_offsets_file):try:import numpy as np1 unmodified linecached_count = len(offsets) - 1if cached_count != EXPECTED_TRAIN_SAMPLES:print(f"⚠️ Detected cached outdated SFT shards ({cached_count:,} vs expected {EXPECTED_TRAIN_SAMPLES:,} samples).")print(f"🧹 Auto-clearing {target_data_folder} to fetch fresh 1M verified shards...")shutil.rmtree(target_data_folder, ignore_errors=True)except Exception as e:print(f"⚠️ Shard validation error ({e}). Re-fetching...")6 unmodified linestry: os.unlink(dst)except Exception: passif not os.path.exists(dst):print(f" ⬇️ Fetching {fname} (Fresh 1M verified dataset)...")dl = hf_hub_download(repo_id=TOKENIZED_DATA_REPO, filename=f"sft_v3/{fname}", repo_type="dataset", token=HF_TOKEN, force_download=True)real_src = os.path.realpath(dl)src_to_copy = real_src if os.path.exists(real_src) else dl1 unmodified linetry: os.unlink(dst)except Exception: passshutil.copyfile(src_to_copy, dst)print(f"✅ Master SFT v3 Gold Dataset Ready in {target_data_folder} (Verified {EXPECTED_TRAIN_SAMPLES:,} Train Samples | 391.5M Tokens/Epoch)!")# 5. Launch 4-GPU DDP via Python distributed module (100% environment safe)print("\n" + "=" * 85)11 unmodified lines"--init_ckpt", base_ckpt_path,"--batch_size", "8","--grad_accum", "4","--epochs", "2","--max_lr", "3.0e-5","--min_lr", "2.0e-6","--neftune_alpha", "1.0",
runners/RUN_QUAD_5090_MASTER_SFT_V3.txt+25-19