Upload runners/RUN_5090_MASTER_SFT_V3.txt with huggingface_hub
Browse files64 unmodified lines6566676869707172737475767778798081828384858687888990912 unmodified lines9495969798991001 unmodified line1021031041051061071081091101 unmodified line1121131141151161171186 unmodified lines1251261271281291301311 unmodified line13313413513613713813918 unmodified lines15815916016116216316411 unmodified lines17617717817918018118264 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. RTX 5090 Rock-Solid Hyperparameters (Zero-OOM Mode)# micro_batch=4, grad_accum=32 (Effective Batch = 128)18 unmodified lines"--init_ckpt", base_ckpt_path,"--batch_size", "4","--grad_accum", str(grad_acc),"--epochs", "3","--max_lr", "3.0e-5","--min_lr", "2.0e-6","--neftune_alpha", "1.0",11 unmodified lines"--init_ckpt", base_ckpt_path,"--batch_size", "4","--grad_accum", "32","--epochs", "3","--max_lr", "3.0e-5","--min_lr", "2.0e-6","--neftune_alpha", "1.0",64 unmodified lines6566676869707172737475767778798081828384858687888990919293949596972 unmodified lines1001011021031041051061 unmodified line1081091101111121131141151161 unmodified line1181191201211221231246 unmodified lines1311321331341351361371 unmodified line13914014114214314414518 unmodified lines16416516616716816917011 unmodified lines18218318418518618718864 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. RTX 5090 Rock-Solid Hyperparameters (Zero-OOM Mode)# micro_batch=4, grad_accum=32 (Effective Batch = 128)18 unmodified lines"--init_ckpt", base_ckpt_path,"--batch_size", "4","--grad_accum", str(grad_acc),"--epochs", "2","--max_lr", "3.0e-5","--min_lr", "2.0e-6","--neftune_alpha", "1.0",11 unmodified lines"--init_ckpt", base_ckpt_path,"--batch_size", "4","--grad_accum", "32","--epochs", "2","--max_lr", "3.0e-5","--min_lr", "2.0e-6","--neftune_alpha", "1.0",
runners/RUN_5090_MASTER_SFT_V3.txt+26-20