[Chore] Use Transformers v5 names and drop redundant processor use_fast (#58550)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
484c211fe8
commit
d881812500
@@ -284,7 +284,7 @@ def as_embedding_model(cls: type[_T]) -> type[_T]:
|
||||
def _resolve_num_labels(hf_config: Any, text_config: Any) -> int:
|
||||
"""Resolve the label count for a sequence classification head.
|
||||
|
||||
``PretrainedConfig.num_labels`` is derived from ``id2label``, which always
|
||||
``PreTrainedConfig.num_labels`` is derived from ``id2label``, which always
|
||||
carries a default of two entries. Composite configs (such as multimodal
|
||||
checkpoints) declare their label space on the top-level config, so reading
|
||||
``num_labels`` from ``get_text_config()`` silently returns that default and
|
||||
@@ -297,9 +297,9 @@ def _resolve_num_labels(hf_config: Any, text_config: Any) -> int:
|
||||
if text_config is hf_config:
|
||||
return hf_config.num_labels
|
||||
|
||||
from transformers import PretrainedConfig
|
||||
from transformers import PreTrainedConfig
|
||||
|
||||
if hf_config.num_labels != PretrainedConfig().num_labels:
|
||||
if hf_config.num_labels != PreTrainedConfig().num_labels:
|
||||
return hf_config.num_labels
|
||||
return text_config.num_labels
|
||||
|
||||
|
||||
Reference in New Issue
Block a user