Skip to content

fix: harden Hugging Face config/weight loading helpers - #1007

Open
Chessing234 wants to merge 2 commits into
state-spaces:mainfrom
Chessing234:fix/hf-load-config-robustness
Open

fix: harden Hugging Face config/weight loading helpers#1007
Chessing234 wants to merge 2 commits into
state-spaces:mainfrom
Chessing234:fix/hf-load-config-robustness

Conversation

@Chessing234

Copy link
Copy Markdown
Contributor

Summary

  • Use a context manager and explicit FileNotFoundError when config.json / pytorch_model.bin hub lookups fail.
  • Pass weights_only=False on PyTorch 2.6+ when loading legacy HF checkpoints.
  • Add CPU-only unit tests mocking cached_file (no CUDA ops import).

Complements #993 (dtype/device load_state_dict_hf fix) without overlapping that change.

Test plan

  • pytest tests/test_hf_utils.py

Made with Cursor

Use context managers for config.json, raise FileNotFoundError when hub
lookup fails, and pass weights_only=False on PyTorch 2.6+ for legacy bins.
Add CPU-only unit tests that mock cached_file without importing CUDA ops.
@Chessing234
Chessing234 force-pushed the fix/hf-load-config-robustness branch from fa4b39a to cafb2cb Compare August 5, 2026 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant