yashash04 commited on
Commit
3cf8472
·
1 Parent(s): cffbfce

Phase M-prep fix: append /final to sft_path in GRPO wrapper

Browse files

Stage 2 [5/7] failed with PEFT 'Can't find adapter_config.json at
/workspace/sft_adapter'. Root cause: Stage 1 SFT wrapper uploaded the
entire /workspace/sft_output folder (which contains final/,
checkpoint-10/, checkpoint-20/ subdirs) to the Hub. snapshot_download
returns the parent folder path. PEFT.from_pretrained needs the path
that DIRECTLY contains adapter_config.json, which is the final/ subfolder.

Stage 1's own training log explicitly hinted at this:
Use in GRPO: python training/grpo_train.py --sft-adapter-path /workspace/sft_output/final ...

Changes to scripts/phase_m_grpo_job.py:
- After snapshot_download, verify adapter_config.json exists at <sft_path>/final
with debug-listing fallback if not found
- Pass --sft-adapter-path <sft_path>/final (not just <sft_path>) to grpo_train.py
- Updated print statements to clarify the root vs resolved adapter paths

Files changed (1) hide show
  1. scripts/phase_m_grpo_job.py +14 -2
scripts/phase_m_grpo_job.py CHANGED
@@ -59,7 +59,19 @@ sft_path = snapshot_download(
59
  token=os.environ["HF_TOKEN"],
60
  local_dir="/workspace/sft_adapter",
61
  )
62
- print(f" SFT adapter at: {sft_path}", flush=True)
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
  # Step 4: Boot env-server in background
65
  print("[4/7] Booting env-server on localhost:8000...", flush=True)
@@ -139,7 +151,7 @@ try:
139
  [
140
  sys.executable, "training/grpo_train.py",
141
  "--model", "unsloth/Qwen3-1.7B-bnb-4bit",
142
- "--sft-adapter-path", sft_path,
143
  "--env-url", "http://localhost:8000",
144
  "--max-steps", "200",
145
  "--batch-size", "4",
 
59
  token=os.environ["HF_TOKEN"],
60
  local_dir="/workspace/sft_adapter",
61
  )
62
+
63
+ # Verify expected adapter file exists at <sft_path>/final
64
+ adapter_config = os.path.join(sft_path, "final", "adapter_config.json")
65
+ if not os.path.exists(adapter_config):
66
+ print(f"ERROR: adapter_config.json not found at {adapter_config}", flush=True)
67
+ print(f"Contents of {sft_path}:", flush=True)
68
+ for root, dirs, files in os.walk(sft_path):
69
+ for f in files[:20]:
70
+ print(f" {os.path.join(root, f)}", flush=True)
71
+ raise FileNotFoundError(f"adapter_config.json missing at {adapter_config}")
72
+ print(f" [OK] Verified adapter_config.json exists", flush=True)
73
+ print(f" SFT adapter root: {sft_path}", flush=True)
74
+ print(f" SFT adapter resolved: {sft_path}/final (adapter_config.json + adapter_model.safetensors)", flush=True)
75
 
76
  # Step 4: Boot env-server in background
77
  print("[4/7] Booting env-server on localhost:8000...", flush=True)
 
151
  [
152
  sys.executable, "training/grpo_train.py",
153
  "--model", "unsloth/Qwen3-1.7B-bnb-4bit",
154
+ "--sft-adapter-path", f"{sft_path}/final",
155
  "--env-url", "http://localhost:8000",
156
  "--max-steps", "200",
157
  "--batch-size", "4",