mirror of
https://github.com/wassname/moral-maps.git
synced 2026-09-11 12:20:38 +08:00
verbose trace: log at DEBUG so callers can hide it from INFO sinks
The 1-row demo block (prompt + think + nudge + prefill + scored token + 64-token free continuation) used logger.info, which meant any caller wrapping the function in an INFO-level sink (e.g. an agent harness) got the full trace in their stdout. Downgrade to logger.debug so it still lands in the user's verbose log but doesn't leak to agents. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
9b4e094724
commit
f9a490c71d
@@ -212,14 +212,15 @@ def _rollout_kv_fork(
|
||||
for j, (nudge, prefill) in enumerate(scoring_slots):
|
||||
suf_ids = suf_ids_for(nudge, prefill)
|
||||
if verbose:
|
||||
# DEBUG, not INFO: keeps the trace in the user's verbose sidecar
|
||||
# but out of any downstream INFO sink the caller might be wrapping.
|
||||
full_text = sp_per_row[0] + tok.decode(suf_ids[0], skip_special_tokens=False)
|
||||
# Free-form generate to see what the model actually says after the prefill.
|
||||
full_ids = torch.tensor(
|
||||
[sp_ids_per_row[0] + suf_ids[0]], device=device, dtype=torch.long,
|
||||
)
|
||||
gen = model.generate(full_ids, max_new_tokens=64, do_sample=False, pad_token_id=pad_id)
|
||||
free = tok.decode(gen[0, full_ids.shape[1]:], skip_special_tokens=False)
|
||||
logger.info(
|
||||
logger.debug(
|
||||
f"--- slot {j} (nudge={nudge!r}, prefill={prefill!r}) ---\n"
|
||||
f"{full_text}<<<MODEL CONTINUES>>>{free}\n--- end slot {j} ---"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user