Upload runners/RUN_5090_MASTER_SFT_V3.txt with huggingface_hub
Browse files64 unmodified lines6566676868697071727173737475767778797475767778798081828382848586878889909186929388949596972 unmodified lines100101102971031041051061 unmodified line1081091101051111121071131141151161 unmodified line1181191201151211221231246 unmodified lines1311321331281341351361371 unmodified line13914014113614214314414518 unmodified lines16416516616116716816917011 unmodified lines18218318417918518618718864 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):is_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) print("🧹 Removed previous broken checkpoint file/symlink.") except Exception: try: os.remove(base_ckpt_path) except Exception: pass
need_download = Trueif os.path.exists(base_ckpt_path) and not os.path.islink(base_ckpt_path): 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: need_download = False is_valid_ckpt = True print(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: pass
if need_download:if not is_valid_ckpt: 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): if os.path.islink(base_ckpt_path) or os.path.lexists(base_ckpt_path): try: os.unlink(base_ckpt_path) except Exception:2 unmodified lines
print(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)# 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 = 266537EXPECTED_TRAIN_SAMPLES = 961274
# Auto-detect outdated shards (e.g. cached 225k samples) or broken files# 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 line cached_count = len(offsets) - 1 if 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...") 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 lines try: os.unlink(dst) except Exception: pass if not os.path.exists(dst): print(f" ⬇️ Fetching {fname} (Fresh 266k dataset)...") 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 line try: os.unlink(dst) except Exception: pass shutil.copyfile(src_to_copy, dst)print(f"✅ Master SFT v3 Gold Dataset Ready in {target_data_folder} (Verified {EXPECTED_TRAIN_SAMPLES:,} Train Samples)!")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", "3", "--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", "3", "--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