Dynamic auto mapping#45018
Conversation
|
run-slow: eurobert, nougat, musicflamingo |
|
This comment contains models: ["models/eurobert", "models/musicflamingo", "models/nougat"] |
|
run-slow: bert, gpt2, t5, modernbert, vit, clip, detr, table_transformer, got_ocr2, whisper, wav2vec2, qwen2_audio, speech_t5, csm, llama, gemma3, qwen2, mistral3, qwen2_5_vl, llava, smolvlm, internvl, gemma3n, gpt_oss, qwen2_5_omni, pi0 |
|
This comment contains models: ["models/bert", "models/clip", "models/csm", "models/detr", "models/gemma3", "models/gemma3n", "models/got_ocr2", "models/gpt2", "models/gpt_oss", "models/internvl", "models/llama", "models/llava", "models/mistral3", "models/modernbert", "models/pi0", "models/qwen2", "models/qwen2_5_omni", "models/qwen2_5_vl", "models/qwen2_audio", "models/smolvlm", "models/t5", "models/table_transformer", "models/vit", "models/wav2vec2", "models/whisper"] |
CI ResultsCommit Info
Model CI Report❌ 11 new failed tests from this PR 😭
|
|
I dont know why it shows these models as new failures, the error message is identical to |
|
[For maintainers] Suggested jobs to run (before merge) run-slow: auto, eurobert, fastspeech2_conformer, idefics, idefics2, kosmos2, kosmos2_5, lighton_ocr |
|
run-slow: eurobert, fastspeech2_conformer, idefics, idefics2, kosmos2, kosmos2_5, lighton_ocr, code_llama, nougat, vision_encoder_decoder |
|
This comment contains models: ["models/code_llama", "models/eurobert", "models/fastspeech2_conformer", "models/idefics", "models/idefics2", "models/kosmos2", "models/kosmos2_5", "models/lighton_ocr", "models/nougat", "models/vision_encoder_decoder"] |
CI ResultsCommit Info
Model CI Report❌ 2 new failed tests from this PR 😭
|
|
Also not related and failing on main, the repo is not found in hub! Then merging it, important models tests are passing and the keys from mapping aren't lost on the way. Instead new entries are added for all sub-configs, so now any sub-backbone can be loaded with |
|
Quick question: in Sentence Transformers I'm using
|
|
@tomaarsen yes, the keys in |
* draft * update * what if * make was changed * ? * can I inspect what the runners have, where is the file? * ??? * only god knows what is wrong with import path * try reinstalling * revrt everythging, it was non-editable install all this time * should be ordered dict * blip was swapped * erm oke * . * ! * nope * ahhh image mapping didn't resolve special names * more * why they are making up non-existant model types * too many non-standard old models * fix repo * discussed with Yoni, delete * style * also revert * cherry-pick from the other pr * make py file * check with recent main for missing entries * delete old models, have to enforce 1-1 mapping for future * add checks for duplicates, official ckpt still working * update 'add-new-model-like' * apply sorting and ruff to file before checking equivalence * run check repo * new models * rename files * and more non standard ones * and fix repo * omg, style pls * fix ty
What does this PR do?
As per title, deletes long lines of auto-mapping and dynamically builds it from code.
The whole auto-generation runs with AST and takes ~5 sec on my machine, so we don't infer anything at run-time. Instead it is built once and saved, similar to
modularfiles. This also uncovered a few issues, e.g. the samemodel_typeis used with different config classes, so imo it is a good opportunity to be more strict about model naming. Thecheck_autowill now complain if there a not one-to-one mapping in configs, because it might lead to incorrect AutoXXX loadingI checked the mapping content that we're not missing any entry from
mainwith this script. Nothing is missing except for a couple keys I deleted on purpose. Those just do not exist, in code or in official hub ckpt.NOTE:
MODEL_MAPPING_NAMESis deleted entirely, as it is not used anywhere in the codebase. It holds official non-lowercase names for each model and we don't use those anywhere, onlykeys