AnswerDotAI / AnswerDotAI/ModernBERT

TypeError: ModernBertForSequenceClassification.__init__() got an unexpected keyword argument 'compile'

Open
#190 6 comments 0 reactions 1 assignee Claimed by @ohmeow View on GitHub
Dominant language
Python
Stars
1.7k
Forks
145
PR merge metrics
No merged PRs in 30d

Description

Hello.
When running [finetune_modernbert_on_glue.ipynb](https://colab.research.google.com/github/AnswerDotAI/ModernBERT/blob/master/examples/finetune_modernbert_on_glue.ipynb) in colab on
```python
hf_model = AutoModelForSequenceClassification.from_pretrained(
checkpoint, num_labels=n_labels, id2label=id2label, label2id=label2id, compile=False
)
```
the `TypeError` raised
```python
TypeError Traceback (most recent call last)
[](https://localhost:8080/#) in ()
----> 1 hf_model = AutoModelForSequenceClassification.from_pretrained(
2 checkpoint, num_labels=n_labels, id2label=id2label, label2id=label2id, compile=False
3 )

1 frames
[/usr/local/lib/python3.11/dist-packages/transformers/models/auto/auto_factory.py](https://localhost:8080/#) in from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
562 elif type(config) in cls._model_mapping.keys():
563 model_class = _get_model_class(config, cls._model_mapping)
--> 564 return model_class.from_pretrained(
565 pretrained_model_name_or_path, *model_args, config=config, **hub_kwargs, **kwargs
566 )

[/usr/local/lib/python3.11/dist-packages/transformers/modeling_utils.py](https://localhost:8080/#) in from_pretrained(cls, pretrained_model_name_or_path, config, cache_dir, ignore_mismatched_sizes, force_download, local_files_only, token, revision, use_safetensors, weights_only, *model_args, **kwargs)
4088 with ContextManagers(init_contexts):
4089 # Let's make sure we don't run the init function of buffer modules
-> 4090 model = cls(config, *model_args, **model_kwargs)
4091
4092 # make sure we use the model's config since the __init__ call might have copied it

TypeError: ModernBertForSequenceClassification.__init__() got an unexpected keyword argument 'compile'
```
![Image](https://github.com/user-attachments/assets/a8eddc05-7496-4969-854f-a166722d4cc6)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.