Compare commits

...
Sign in to create a new pull request.

3 commits

Author SHA1 Message Date
Aditya Ghai
a454c212d8 Using a loop to handle the sequence classification parameters.
git pull origin fix/bert-num-labels --rebase#    pick 779c4b06 Using a loop to handle the sequence classification parameters.
2026-03-12 09:14:18 +00:00
pre-commit-ci[bot]
b46269f7dd [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-03-12 09:14:18 +00:00
Aditya Ghai
fbff0292bd Fix: ModernBERT sequence classification num_labels support 2026-03-12 09:14:18 +00:00

View file

@ -782,6 +782,13 @@ class FastBaseModel:
setattr(auto_config, "attn_implementation", config_attn_impl)
model_config = auto_config
# Handle sequence classification parameters (num_labels, id2label, label2id)
# These need to be set in the config before model instantiation
for param in ("num_labels", "id2label", "label2id"):
value = kwargs.pop(param, None)
if value is not None:
setattr(model_config, param, value)
verify_fp8_support_if_applicable(model_config)
raise_handler = RaiseUninitialized()