You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update how Hugging Face's config files are processed (microsoft#1693)
### Description
This PR updates how Hugging Face's config files are processed while
creating the `genai_config.json` file for ONNX Runtime GenAI.
### Motivation and Context
The `config.json` file typically stores model attributes while the
`generation_config.json` file typically stores search attributes. Some
fields can overlap between the two files, and the latter file typically
contains more detailed information than the former file for a particular
attribute (e.g. the
[`config.json`](https://huggingface.co/google/gemma-3-270m-it/blob/main/config.json#L10)
file for `google/gemma-3-270m-it` says that `eos_token_id = 1` but the
[`generation_config.json`](https://huggingface.co/google/gemma-3-270m-it/blob/main/generation_config.json#L4)
file for the same model says that `eos_token_id = [1, 106]`).
To ensure the right attributes are stored, we compare the values stored
in `generation_config.json` with the traditional default values loaded
in `config.json`. If they do not match, then the values in `config.json`
are rewritten with the `generation_config.json` values.
With this PR, models such as
[`google/gemma-3-270m-it`](https://huggingface.co/google/gemma-3-270m-it)
and [`janhq/Jan-v1-4B`](https://huggingface.co/janhq/Jan-v1-4B) can be
set with their default search values.
"bos_token_id": config.bos_token_idifhasattr(config, "bos_token_id") andconfig.bos_token_idisnotNoneelse1, # config.bos_token_id not present in ChatGLM model configs.
0 commit comments