Spaces:
Running on Zero
Running on Zero
Download lib/util/checkpoint_compat.py from hugging-apps/spaceflow: direct link, hf CLI and curl.
- Browser
- Download file 609 Bytes
-
https://huggingface.co/spaces/hugging-apps/spaceflow/resolve/main/lib/util/checkpoint_compat.py
- Command line
-
hf download hf://spaces/hugging-apps/spaceflow/lib/util/checkpoint_compat.py
-
curl -L -o checkpoint_compat.py https://huggingface.co/spaces/hugging-apps/spaceflow/resolve/main/lib/util/checkpoint_compat.py
609 Bytes
| """Scoped compatibility for the recorded upstream PartField checkpoint.""" | |
| from contextlib import contextmanager | |
| def partfield_checkpoint_scope(): | |
| """Allow the checkpoint's YACS configuration with PyTorch weights-only loading. | |
| PartField stores a CfgNode alongside its tensors. Lightning 2.2 delegates | |
| loading to torch.load, whose default changed in PyTorch 2.6. Keep that | |
| default and allow only this configuration class while PartField loads. | |
| """ | |
| import torch | |
| from yacs.config import CfgNode | |
| with torch.serialization.safe_globals([CfgNode]): | |
| yield | |