fix: filter frozen pools by requested task_types subset
This commit is contained in:
@@ -320,9 +320,15 @@ def _filter_untrainable_types(
|
||||
"""
|
||||
diag_by_type = Counter(u.task_type for u in build_units(pools.diagnosis))
|
||||
val_by_type = Counter(u.task_type for u in build_units(pools.validation))
|
||||
# 先按调用方显式 task_types 收窄候选集:未请求的题型(哪怕可训练)不得进入
|
||||
# keep,否则冻结全局 pools 后 batch/diagnosis 会训练非请求题型,而 gate 只覆盖
|
||||
# 请求题型 → 静默语义偏差(I-4)。task_types=None 表示全部题型皆为候选。
|
||||
candidates = set(diag_by_type) | set(val_by_type)
|
||||
if task_types is not None:
|
||||
candidates &= set(task_types)
|
||||
keep: set[str] = set()
|
||||
dropped: list[tuple[str, str]] = []
|
||||
for tt in set(diag_by_type) | set(val_by_type):
|
||||
for tt in candidates:
|
||||
n_val = val_by_type.get(tt, 0)
|
||||
n_units = diag_by_type.get(tt, 0) + n_val
|
||||
if n_val < eval_min_per_class:
|
||||
|
||||
Reference in New Issue
Block a user