Fix reward/classification models broken by load_weights v2 dispatch (#28671) (#31988)

Co-authored-by: Alex Nails <alex.nails@radixark.ai>
This commit is contained in:
Jialin Ouyang
2026-07-21 18:47:49 -07:00
committed by GitHub
co-authored by Alex Nails
parent 878d77929d
commit 4597dd4d88
4 changed files with 4 additions and 4 deletions
@@ -83,7 +83,7 @@ class LlamaForClassification(nn.Module):
elif "lm_head" in name:
continue
else:
LlamaForCausalLM.load_weights(self, [(name, loaded_weight)])
LlamaForCausalLM._legacy_load_weights(self, [(name, loaded_weight)])
EntryClass = LlamaForClassification
+1 -1
View File
@@ -74,7 +74,7 @@ class LlamaForSequenceClassification(nn.Module):
)
def load_weights(self, weights: Iterable[Tuple[str, torch.Tensor]]):
return LlamaForCausalLM.load_weights(self, weights)
return LlamaForCausalLM._legacy_load_weights(self, weights)
class LlamaForSequenceClassificationWithNormal_Weights(LlamaForSequenceClassification):
@@ -71,7 +71,7 @@ class Qwen2ForSequenceClassification(nn.Module):
filtered_weights = [
(name, w) for name, w in weights if not name.startswith("lm_head")
]
return Qwen2ForCausalLM.load_weights(self, filtered_weights)
return Qwen2ForCausalLM._legacy_load_weights(self, filtered_weights)
EntryClass = [
+1 -1
View File
@@ -84,7 +84,7 @@ class Qwen2ForRewardModel(nn.Module):
filtered_weights = [
(name, w) for name, w in weights if not name.startswith("lm_head")
]
return Qwen2ForCausalLM.load_weights(self, filtered_weights)
return Qwen2ForCausalLM._legacy_load_weights(self, filtered_weights)
EntryClass = [