23f2002275 Claude Sonnet 4.6 commited on
Commit
9c646f0
·
1 Parent(s): d92866e

fix(train): accept wandb_v1_ key format in W&B gate check

Browse files

isalnum() rejects the new wandb_v1_XXX key format which contains
underscores. Widen the check to allow underscores so W&B logging
is not silently disabled for users with new-format API keys.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. train/grpo.py +2 -1
train/grpo.py CHANGED
@@ -135,7 +135,8 @@ def run_grpo(
135
  "near 1.0 (avoids QLoRA + vLLM merge drift bug)."
136
  )
137
  wb_key = os.environ.get("WANDB_API_KEY", "").strip()
138
- use_wandb = len(wb_key) >= 40 and wb_key.isalnum()
 
139
  _set_if_supported(["report_to"], ["wandb"] if use_wandb else [])
140
  if not use_wandb:
141
  log.warning(
 
135
  "near 1.0 (avoids QLoRA + vLLM merge drift bug)."
136
  )
137
  wb_key = os.environ.get("WANDB_API_KEY", "").strip()
138
+ # Accept both old-style (40-char alnum) and new wandb_v1_ keys (contain underscores).
139
+ use_wandb = len(wb_key) >= 40 and all(c.isalnum() or c == "_" for c in wb_key)
140
  _set_if_supported(["report_to"], ["wandb"] if use_wandb else [])
141
  if not use_wandb:
142
  log.warning(