[Bugfix] Reject matryoshka embedding dimensions above hidden size (#46313)

Signed-off-by: EazyReal <8047065+EazyReal@users.noreply.github.com>
Co-authored-by: EazyReal <8047065+EazyReal@users.noreply.github.com>
This commit is contained in:
Maxwill Lin
2026-06-22 10:16:35 +00:00
committed by GitHub
co-authored by EazyReal
parent 89accad2cc
commit 78739e3bda
2 changed files with 28 additions and 0 deletions
+5
View File
@@ -182,6 +182,11 @@ class PoolingParams(
)
elif self.dimensions < 1:
raise ValueError("Dimensions must be greater than 0")
elif self.dimensions > model_config.embedding_size:
raise ValueError(
"Dimensions must be less than or equal to the model's "
f"embedding size ({model_config.embedding_size})"
)
elif self.task in ["classify", "token_classify"]:
if self.use_activation is None: