Update README.md
Browse files
README.md
CHANGED
|
@@ -2,4 +2,48 @@
|
|
| 2 |
license: mit
|
| 3 |
base_model:
|
| 4 |
- facebook/sapiens
|
| 5 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
license: mit
|
| 3 |
base_model:
|
| 4 |
- facebook/sapiens
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
# Sapiens Exported Model (Schema 7.3)
|
| 8 |
+
|
| 9 |
+
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**.
|
| 10 |
+
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
## Background
|
| 14 |
+
|
| 15 |
+
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.
|
| 16 |
+
|
| 17 |
+
Many users encounter the following error:
|
| 18 |
+
|
| 19 |
+
`ValueError: invalid literal for int() with base 10: b'5.1'`
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
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.
|
| 23 |
+
|
| 24 |
+
---
|
| 25 |
+
|
| 26 |
+
## Contents
|
| 27 |
+
|
| 28 |
+
- `..._bfloat16.pt2`: Re-exported IR checkpoint
|
| 29 |
+
- Compatible with: `torch.export.load()` in **PyTorch ≥ 2.3.0**
|
| 30 |
+
- Schema version: **7.3**
|
| 31 |
+
|
| 32 |
+
---
|
| 33 |
+
|
| 34 |
+
## How to Load
|
| 35 |
+
|
| 36 |
+
```python
|
| 37 |
+
from torch.export import load
|
| 38 |
+
from huggingface_hub import hf_hub_download
|
| 39 |
+
|
| 40 |
+
model_path = hf_hub_download("RyanL22/sapiens-bfloat16", "pose/checkpoints/sapiens_1b_goliath_best_goliath_AP_639_bfloat16.pt2")
|
| 41 |
+
model = load(model_path).module()
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
🔧 Make sure you are using PyTorch 2.3.0 or higher to ensure schema 7.x compatibility.
|
| 45 |
+
|
| 46 |
+
Credits
|
| 47 |
+
Original model: facebook/sapiens
|
| 48 |
+
|
| 49 |
+
Re-exported by: @RyanL22
|