| | --- |
| | license: mit |
| | base_model: |
| | - facebook/sapiens |
| | --- |
| | |
| | # Sapiens Exported Model (Schema 7.3) |
| |
|
| | This repository provides a re-exported checkpoint of the [facebook/sapiens](https://huggingface.co/facebook/sapiens) segmentation model using **PyTorch 2.5.1**, ensuring compatibility with **modern `torch.export.load()` workflows**. |
| |
|
| | --- |
| |
|
| | ## Background |
| |
|
| | The original SAPIENS checkpoints were exported in PyTorch 2.1.x and use **IR schema version `5.1`**, which causes `torch.export.load()` to fail on newer PyTorch versions (e.g., 2.2+), due to a mismatch in how versioning is handled internally. |
| |
|
| | Many users encounter the following error: |
| |
|
| | `ValueError: invalid literal for int() with base 10: b'5.1'` |
| |
|
| |
|
| | To address this, we provide a **re-exported checkpoint** using **PyTorch 2.5.1**, which uses **schema version `7.3`**, fully compatible with current and future versions of PyTorch. |
| |
|
| | --- |
| |
|
| | ## Contents |
| |
|
| | - `..._bfloat16.pt2`: Re-exported IR checkpoint |
| | - Compatible with: `torch.export.load()` in **PyTorch ≥ 2.3.0** |
| | - Schema version: **7.3** |
| |
|
| | --- |
| |
|
| | ## How to Load |
| |
|
| | ```python |
| | from torch.export import load |
| | from huggingface_hub import hf_hub_download |
| | |
| | model_path = hf_hub_download("RyanL22/sapiens-bfloat16", "pose/checkpoints/sapiens_1b_goliath_best_goliath_AP_639_bfloat16.pt2") |
| | model = load(model_path).module() |
| | ``` |
| |
|
| | 🔧 Make sure you are using PyTorch 2.3.0 or higher to ensure schema 7.x compatibility. |
| |
|
| | Credits |
| | Original model: facebook/sapiens |
| |
|
| | Re-exported by: @RyanL22 |