[`ModernBERT`] Never save 'reference_compile' config; should be set based on end user
Author: tomaarsen
Pull request: yes

# What does this PR do?
* Never save `reference_compile` in `ModernBertConfig`

## Details
The ModernBERT architecture uses a `reference_compile` config option to determine whether various model layers are compiled. However, not every system supports this, so we either 1) use the user's provided value, 2) use the option in the config, or 3) set it automatically based on the user's system.

However, it seems that if you save a model, it will save `reference_compile` into the config. This is very problematic, as end users who cannot run compilation will be "forced" into compilation (option 2) instead of determining whether compilation is possible (option 3). This is quite annoying for smooth usage.

When this is merged and released, I'll consider writing a script that makes PRs on all ~850 [ModernBERT models](https://huggingface.co/models?other=modernbert) to remove the `reference_compile` option from their configs, so it's always just based on the user's system (or manual parameters).

## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#create-a-pull-request),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [x] Did you write any new necessary tests?


## Who can review?

@ArthurZucker



- Tom Aarsen


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_36305). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Thank you for your PR. I've encountered some related issues. Specifically, when I tried to implement the solution you mentioned at https://huggingface.co/answerdotai/ModernBERT-base/discussions/14#67695db4f711d4eac4a43ddf.

```bash
Traceback (most recent call last):
  File "/mnt/dolphinfs/ssd_pool/docker/user/hadoop-aipnlp/INS/ruanjunhao04/mtr/eval/document_embedding.py", line 134, in <module>
    array = AsyncEngineArray.from_args([
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/dolphinfs/ssd_pool/docker/user/hadoop-aipnlp/INS/ruanjunhao04/miniforge3/envs/sglang/lib/python3.12/site-packages/infinity_emb/engine.py", line 307, in from_args
    return cls(engines=tuple(engines))
                       ^^^^^^^^^^^^^^
  File "/mnt/dolphinfs/ssd_pool/docker/user/hadoop-aipnlp/INS/ruanjunhao04/miniforge3/envs/sglang/lib/python3.12/site-packages/infinity_emb/engine.py", line 72, in from_args
    engine = cls(**engine_args.to_dict(), _show_deprecation_warning=False)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/dolphinfs/ssd_pool/docker/user/hadoop-aipnlp/INS/ruanjunhao04/miniforge3/envs/sglang/lib/python3.12/site-packages/infinity_emb/engine.py", line 56, in __init__
    self._model_replicas, self._min_inference_t, self._max_inference_t = select_model(
                                                                         ^^^^^^^^^^^^^
  File "/mnt/dolphinfs/ssd_pool/docker/user/hadoop-aipnlp/INS/ruanjunhao04/miniforge3/envs/sglang/lib/python3.12/site-packages/infinity_emb/inference/select_model.py", line 81, in select_model
    loaded_engine = unloaded_engine.value(engine_args=engine_args_copy)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/dolphinfs/ssd_pool/docker/user/hadoop-aipnlp/INS/ruanjunhao04/miniforge3/envs/sglang/lib/python3.12/site-packages/infinity_emb/transformer/embedder/sentence_transformer.py", line 81, in __init__
    super().__init__(
  File "/mnt/dolphinfs/ssd_pool/docker/user/hadoop-aipnlp/INS/ruanjunhao04/miniforge3/envs/sglang/lib/python3.12/site-packages/sentence_transformers/SentenceTransformer.py", line 321, in __init__
    modules = self._load_auto_model(
              ^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/dolphinfs/ssd_pool/docker/user/hadoop-aipnlp/INS/ruanjunhao04/miniforge3/envs/sglang/lib/python3.12/site-packages/sentence_transformers/SentenceTransformer.py", line 1600, in _load_auto_model
    transformer_model = Transformer(
                        ^^^^^^^^^^^^
  File "/mnt/dolphinfs/ssd_pool/docker/user/hadoop-aipnlp/INS/ruanjunhao04/miniforge3/envs/sglang/lib/python3.12/site-packages/sentence_transformers/models/Transformer.py", line 81, in __init__
    self._load_model(model_name_or_path, config, cache_dir, backend, is_peft_model, **model_args)
  File "/mnt/dolphinfs/ssd_pool/docker/user/hadoop-aipnlp/INS/ruanjunhao04/miniforge3/envs/sglang/lib/python3.12/site-packages/sentence_transformers/models/Transformer.py", line 182, in _load_model
    self.auto_model = AutoModel.from_pretrained(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/dolphinfs/ssd_pool/docker/user/hadoop-aipnlp/INS/ruanjunhao04/miniforge3/envs/sglang/lib/python3.12/site-packages/transformers/models/auto/auto_factory.py", line 572, in from_pretrained
    return model_class.from_pretrained(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/dolphinfs/ssd_pool/docker/user/hadoop-aipnlp/INS/ruanjunhao04/miniforge3/envs/sglang/lib/python3.12/site-packages/transformers/modeling_utils.py", line 279, in _wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/dolphinfs/ssd_pool/docker/user/hadoop-aipnlp/INS/ruanjunhao04/miniforge3/envs/sglang/lib/python3.12/site-packages/transformers/modeling_utils.py", line 4342, in from_pretrained
    model = cls(config, *model_args, **model_kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: ModernBertModel.__init__() got an unexpected keyword argument 'reference_compile'

```