fix SFT NaN: max_grad_norm=1, lr=5e-5, lora_alpha=128 default; harden workdir
Browse files46 unmodified lines4748495051525354555657585964 unmodified lines12412512612712812913013155 unmodified lines18718818919019119286 unmodified lines27928028128228328490 unmodified lines37537637737837938038138246 unmodified linesif not (work / "data" / "sft_traces.jsonl").exists():if work.exists():subprocess.run(["rm", "-rf", str(work)], check=True)subprocess.run(["git", "clone", "--depth", "1","https://huggingface.co/spaces/sai1906/opsguard", str(work)],check=True,)sys.path.insert(0, str(work))os.chdir(work)return work64 unmodified linesper_device_train_batch_size=args.batch_size,gradient_accumulation_steps=args.grad_accum,num_train_epochs=n_epochs,learning_rate=1e-4,warmup_ratio=0.03,logging_steps=2,save_strategy="epoch",save_total_limit=1,55 unmodified linesgradient_accumulation_steps=8,num_train_epochs=n_epochs,learning_rate=5e-6,beta=0.1,max_length=2048,max_prompt_length=1500,86 unmodified linesmax_prompt_length=1500,beta=0.001,learning_rate=5e-6,logging_steps=1,save_strategy="no",bf16=True,90 unmodified lineshelp="Use bnb 4-bit (default false = bf16 full). Toggle for VRAM-constrained env.")ap.add_argument("--lora-r", type=int, default=128,help="LoRA rank (default 128 for bold). 32 for cheap.")ap.add_argument("--lora-alpha", type=int, default=256,help="LoRA alpha (default 256 = 2*r).")ap.add_argument("--sft-epochs", type=int, default=5)ap.add_argument("--dpo-epochs", type=int, default=3)ap.add_argument("--grpo-steps", type=int, default=200)46 unmodified lines4748495051525354555657585960616263646564 unmodified lines13013113213313413513613713813955 unmodified lines19519619719819920020120286 unmodified lines28929029129229329429529690 unmodified lines38738838939039139239339446 unmodified linesif not (work / "data" / "sft_traces.jsonl").exists():if work.exists():subprocess.run(["rm", "-rf", str(work)], check=True)token = os.environ.get("HF_TOKEN", "")url = (f"https://user:{token}@huggingface.co/spaces/sai1906/opsguard"if token else "https://huggingface.co/spaces/sai1906/opsguard")subprocess.run(["git", "clone", "--depth", "1", url, str(work)], check=True)sys.path.insert(0, str(work))os.chdir(work)needed = work / "data" / "sft_traces.jsonl"if not needed.exists():raise FileNotFoundError(f"{needed} missing after clone. cwd={os.getcwd()} "f"contents={list(work.iterdir()) if work.exists() else 'workdir-missing'}")print(f"[workdir] cwd={os.getcwd()} data files OK", flush=True)return work64 unmodified linesper_device_train_batch_size=args.batch_size,gradient_accumulation_steps=args.grad_accum,num_train_epochs=n_epochs,learning_rate=5e-5,max_grad_norm=1.0,weight_decay=0.01,warmup_ratio=0.05,logging_steps=2,save_strategy="epoch",save_total_limit=1,55 unmodified linesgradient_accumulation_steps=8,num_train_epochs=n_epochs,learning_rate=5e-6,max_grad_norm=1.0,weight_decay=0.01,beta=0.1,max_length=2048,max_prompt_length=1500,86 unmodified linesmax_prompt_length=1500,beta=0.001,learning_rate=5e-6,max_grad_norm=1.0,weight_decay=0.01,logging_steps=1,save_strategy="no",bf16=True,90 unmodified lineshelp="Use bnb 4-bit (default false = bf16 full). Toggle for VRAM-constrained env.")ap.add_argument("--lora-r", type=int, default=128,help="LoRA rank (default 128 for bold). 32 for cheap.")ap.add_argument("--lora-alpha", type=int, default=128,help="LoRA alpha (default 128 = r, scaling 1.0 for stability).")ap.add_argument("--sft-epochs", type=int, default=5)ap.add_argument("--dpo-epochs", type=int, default=3)ap.add_argument("--grpo-steps", type=int, default=200)
scripts/bold_pipeline.py+21-9