Pinning a Hugging Face model revision doesn't pin its code
A technical deep dive found that loading a Hugging Face model with revision set to a commit hash still runs code from another repo's main branch when config.json uses auto_map. Of the 1,000 most-downloaded models, 53 pull code from a separate repo, totaling about 22 million downloads a month, mostly embedding families.
- 53 of the top 1,000 Hub models load code from another repo
- Together they get about 22 million downloads a month
- For 22 of 53, the code repo changed after the model did
- code_revision works in AutoModel but is dropped by pipeline() and Sentence Transformers
Read next
AI