Upload runners/RUN_QUAD_5090_MASTER_SFT_V3.txt with huggingface_hub
Browse files89 unmodified lines9091929394959697989910010110210310410510610710810911011111211311411589 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 Shardsneeded_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","metadata.json"]target_data_folder = "tokenized_data/sft_v3"os.makedirs(target_data_folder, exist_ok=True)for fname in needed_shards:dst = os.path.join(target_data_folder, fname)if os.path.lexists(dst) and not os.path.exists(dst):try: os.remove(dst)except Exception: passif not os.path.exists(dst):print(f" ⬇️ Fetching {fname}...")dl = hf_hub_download(repo_id=TOKENIZED_DATA_REPO, filename=f"sft_v3/{fname}", repo_type="dataset", token=HF_TOKEN)real_src = os.path.realpath(dl)src_to_copy = real_src if os.path.exists(real_src) else dlshutil.copyfile(src_to_copy, dst)print(f"✅ Master SFT v3 Gold Dataset Ready in {target_data_folder}!")# 5. Launch 4-GPU DDP via Python distributed module (100% environment safe)print("\n" + "=" * 85)89 unmodified lines9091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413589 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","metadata.json"]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 npoffsets = np.load(train_offsets_file, mmap_mode="r")cached_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...")shutil.rmtree(target_data_folder, ignore_errors=True)os.makedirs(target_data_folder, exist_ok=True)for fname in needed_shards:dst = os.path.join(target_data_folder, fname)if os.path.islink(dst) or (os.path.lexists(dst) and not os.path.exists(dst)):try: 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 dlif os.path.islink(dst) or os.path.lexists(dst):try: 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)
runners/RUN_QUAD_5090_MASTER_SFT_V3.txt+26-6