BHARGAV REDDY commited on
Upload sft_train.py with huggingface_hub
Browse files377 unmodified lines37837938038138238383 unmodified lines467468469470471472473474475476477478479480481377 unmodified linescfg = {"auto_config": raw.get("auto_config", True),"hf_model_repo": raw.get("hf_model_repo", "ASTERIZER/LUNA-100M"),"hf_dataset_repo": raw.get("hf_dataset_repo", "ASTERIZER/Luna_Dataset"),"pretrained_ckpt": raw.get("pretrained_ckpt", "Base/out/pretrain/luna_100m/latest.pt"),"train_json": raw.get("train_json", "Base/Datasets/sft_clean/train.json"),83 unmodified linesif not ckpt_path.exists() and cfg.get("hf_model_repo"):# Auto-download from HuggingFace model repoprint(f"\n Pretrained checkpoint not found locally.")print(f" Downloading from HuggingFace: {cfg['hf_model_repo']}")from huggingface_hub import hf_hub_downloadckpt_path.parent.mkdir(parents=True, exist_ok=True)hf_hub_download(repo_id=cfg["hf_model_repo"],filename="latest.pt",local_dir=str(ckpt_path.parent),token=os.environ.get("HF_TOKEN"),)print(f" Downloaded to: {ckpt_path}")if ckpt_path.exists():377 unmodified lines37837938038138238338483 unmodified lines468469470471472473474475476477478479480481482483484485377 unmodified linescfg = {"auto_config": raw.get("auto_config", True),"hf_model_repo": raw.get("hf_model_repo", "ASTERIZER/LUNA-100M"),"hf_model_file": raw.get("hf_model_file", "latest.pt"),"hf_dataset_repo": raw.get("hf_dataset_repo", "ASTERIZER/Luna_Dataset"),"pretrained_ckpt": raw.get("pretrained_ckpt", "Base/out/pretrain/luna_100m/latest.pt"),"train_json": raw.get("train_json", "Base/Datasets/sft_clean/train.json"),83 unmodified linesif not ckpt_path.exists() and cfg.get("hf_model_repo"):# Auto-download from HuggingFace model repoprint(f"\n Pretrained checkpoint not found locally.")print(f" Downloading from HuggingFace: {cfg['hf_model_repo']} ({cfg['hf_model_file']})")from huggingface_hub import hf_hub_downloadckpt_path.parent.mkdir(parents=True, exist_ok=True)downloaded = hf_hub_download(repo_id=cfg["hf_model_repo"],filename=cfg["hf_model_file"],local_dir=str(ckpt_path.parent),token=os.environ.get("HF_TOKEN"),)downloaded_path = Path(downloaded)if not ckpt_path.exists() and downloaded_path.exists():ckpt_path = downloaded_pathprint(f" Downloaded to: {ckpt_path}")if ckpt_path.exists():
sft_train.py+7-3