fix(trainer): support continuous reward scores in bucket aggregation
int() truncates any float in [0,1) to 0. Replace with float(). Also fix falsy float check in failure detection. Backward compatible with binary hard=0/1.
This commit is contained in:
@@ -374,7 +374,7 @@ def _compute_task_type_buckets(results: list[dict], task_types: list[str]) -> di
|
|||||||
if key not in buckets:
|
if key not in buckets:
|
||||||
buckets[key] = {"total": 0, "hard": 0, "soft": 0.0}
|
buckets[key] = {"total": 0, "hard": 0, "soft": 0.0}
|
||||||
buckets[key]["total"] += 1
|
buckets[key]["total"] += 1
|
||||||
buckets[key]["hard"] += int(r.get("hard", 0))
|
buckets[key]["hard"] += float(r.get("hard", 0))
|
||||||
buckets[key]["soft"] += float(r.get("soft", 0.0))
|
buckets[key]["soft"] += float(r.get("soft", 0.0))
|
||||||
return buckets
|
return buckets
|
||||||
|
|
||||||
@@ -393,7 +393,7 @@ def _extract_failure_patterns(
|
|||||||
Uses analyst ``failure_summary`` from minibatch patches when available,
|
Uses analyst ``failure_summary`` from minibatch patches when available,
|
||||||
otherwise falls back to ``fail_reason`` prefix grouping.
|
otherwise falls back to ``fail_reason`` prefix grouping.
|
||||||
"""
|
"""
|
||||||
failures = [r for r in rollout_results if not r.get("hard")]
|
failures = [r for r in rollout_results if not r.get("hard") or float(r.get("hard", 0)) < 1e-9]
|
||||||
if not failures:
|
if not failures:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
@@ -1322,7 +1322,7 @@ class ReflACTTrainer:
|
|||||||
# ── Step buffer: unified failure patterns + rejected edits ─
|
# ── Step buffer: unified failure patterns + rejected edits ─
|
||||||
action = step_rec.get("action", "unknown")
|
action = step_rec.get("action", "unknown")
|
||||||
n_total = len(all_rollout_results) or 1
|
n_total = len(all_rollout_results) or 1
|
||||||
n_fail = sum(1 for r in all_rollout_results if not r.get("hard"))
|
n_fail = sum(1 for r in all_rollout_results if not r.get("hard") or float(r.get("hard", 0)) < 1e-9)
|
||||||
failure_patterns = _extract_failure_patterns(
|
failure_patterns = _extract_failure_patterns(
|
||||||
all_rollout_results, step_dir,
|
all_rollout_results, step_dir,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user