Unverified Commit ed359c49 authored by wang.yuqi's avatar wang.yuqi Committed by GitHub
Browse files

[Model] Deprecate the score task (this will not affect users). (#37537)


Signed-off-by: default avatarwang.yuqi <yuqi.wang@daocloud.io>
parent dcee9be9
...@@ -8,7 +8,6 @@ GENERATION_TASKS: tuple[GenerationTask, ...] = get_args(GenerationTask) ...@@ -8,7 +8,6 @@ GENERATION_TASKS: tuple[GenerationTask, ...] = get_args(GenerationTask)
PoolingTask = Literal[ PoolingTask = Literal[
"embed", "embed",
"classify", "classify",
"score",
"token_embed", "token_embed",
"token_classify", "token_classify",
"plugin", "plugin",
...@@ -16,10 +15,6 @@ PoolingTask = Literal[ ...@@ -16,10 +15,6 @@ PoolingTask = Literal[
] ]
POOLING_TASKS: tuple[PoolingTask, ...] = get_args(PoolingTask) POOLING_TASKS: tuple[PoolingTask, ...] = get_args(PoolingTask)
# Score API handles score/rerank for:
# - "score" task (score_type: cross-encoder models)
# - "embed" task (score_type: bi-encoder models)
# - "token_embed" task (score_type: late interaction models)
ScoreType = Literal["bi-encoder", "cross-encoder", "late-interaction"] ScoreType = Literal["bi-encoder", "cross-encoder", "late-interaction"]
FrontendTask = Literal["render"] FrontendTask = Literal["render"]
......
...@@ -2834,15 +2834,7 @@ class GPUModelRunner( ...@@ -2834,15 +2834,7 @@ class GPUModelRunner(
if not is_pooling_model(model): if not is_pooling_model(model):
return [] return []
supported_tasks = list(model.pooler.get_supported_tasks()) return list(model.pooler.get_supported_tasks())
if "score" in supported_tasks:
num_labels = getattr(self.model_config.hf_config, "num_labels", 0)
if num_labels != 1:
supported_tasks.remove("score")
logger.debug_once("Score API is only enabled for num_labels == 1.")
return supported_tasks
def get_supported_tasks(self) -> tuple[SupportedTask, ...]: def get_supported_tasks(self) -> tuple[SupportedTask, ...]:
tasks = list[SupportedTask]() tasks = list[SupportedTask]()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment