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! |
- Dockerfile: COPY source + install deps from requirements.txt (frozen pip-freeze lockfile) with --no-build-isolation --no-deps; commented-out alternative uses constraints.txt (version-unlocked) - pyproject.toml: drop torch-family deps (container provides them); add xformers as direct ROCm wheel URL to prevent PyPI CUDA pull; bump ruff target to py312 - requirements.txt: frozen lockfile of all installed packages - constraints.txt: URL constraints pinning torch-family to ROCm wheels - sam_audio/model/base.py: fix huggingface_hub >= 1.0 compatibility (backport of upstream PR facebookresearch#97 — default args + commented proxies/ resume_download) - test_sam_audio.py: inference script (loads sam-audio-large, processes office.mp4, saves target/residual wav); requires HF_TOKEN env var - .dockerignore: exclude .git, build artifacts, infra files from context - README/AGENTS/docs: update for completed install, add HF_TOKEN run instructions, fix sudo→wheel group, add bind-mount dev tip
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.