Fix huggingface_hub >= 1.0 compatibility in BaseModel._from_pretrained#97
Fix huggingface_hub >= 1.0 compatibility in BaseModel._from_pretrained#97wredan wants to merge 1 commit into
Conversation
|
Hi @wredan! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Problem
huggingface_hub >= 1.0removedproxiesandresume_downloadfrom the keyword arguments passed byModelHubMixin.from_pretrained()to the user-defined_from_pretrained()hook. This causes aTypeErrorat model load time with any recent installation:Reported in #85, #89, and #90. The workarounds suggested there (downgrading
huggingface_hubto 0.36.0 or hardcoding default values) are fragile and break other dependencies.Fix
proxies,resume_download,local_files_only, andtokenoptional withNone/Falsedefaults in_from_pretrained(), matching the newModelHubMixincontract.proxiesandresume_downloadfrom thesnapshot_download()call: both parameters have been removed fromsnapshot_download's signature inhuggingface_hub >= 1.0and passing them would raise aTypeErrorthere as well.Tested with
huggingface_hub==1.10.1+transformers==5.5.3Verified end-to-end:
SAMAudio.from_pretrained()loads without error,model.separate()produces valid output on real audio.