Fix Qwen235 state reweighting
This commit is contained in:
@@ -508,6 +508,28 @@ def reweight(
|
||||
for batch_size, count in histogram.items()
|
||||
if int(batch_size) in by_batch
|
||||
}
|
||||
covered = sum(supported.values())
|
||||
if covered == 0:
|
||||
return {"coverage": 0.0, "components_ms": None, "unsupported": histogram}
|
||||
values = {
|
||||
category: sum(
|
||||
by_batch[batch_size]["components_ms"][category] * count
|
||||
for batch_size, count in supported.items()
|
||||
)
|
||||
/ covered
|
||||
for category in (*CATEGORIES, "total")
|
||||
}
|
||||
return {
|
||||
"coverage": covered / total_samples,
|
||||
"supported_samples": covered,
|
||||
"total_samples": total_samples,
|
||||
"components_ms": values,
|
||||
"unsupported": {
|
||||
batch_size: count
|
||||
for batch_size, count in histogram.items()
|
||||
if int(batch_size) not in by_batch
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def reweight_joint(
|
||||
@@ -544,30 +566,6 @@ def reweight_joint(
|
||||
if state not in by_state
|
||||
},
|
||||
}
|
||||
covered = sum(supported.values())
|
||||
if covered == 0:
|
||||
return {"coverage": 0.0, "components_ms": None, "unsupported": histogram}
|
||||
values = {
|
||||
category: sum(
|
||||
by_batch[batch_size]["components_ms"][category] * count
|
||||
for batch_size, count in supported.items()
|
||||
)
|
||||
/ covered
|
||||
for category in (*CATEGORIES, "total")
|
||||
}
|
||||
return {
|
||||
"coverage": covered / total_samples,
|
||||
"supported_samples": covered,
|
||||
"total_samples": total_samples,
|
||||
"components_ms": values,
|
||||
"unsupported": {
|
||||
batch_size: count
|
||||
for batch_size, count in histogram.items()
|
||||
if int(batch_size) not in by_batch
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def subtract(right: dict[str, float], left: dict[str, float]) -> dict[str, float]:
|
||||
return {name: right[name] - left[name] for name in left}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user