Add checkpoint manifest and configuration-based downloads
Browse files- README.md +25 -11
- config.json +31 -0
README.md
CHANGED
|
@@ -79,24 +79,38 @@ pip install -r requirements-optional.txt
|
|
| 79 |
|
| 80 |
### Download Checkpoints
|
| 81 |
|
| 82 |
-
Download all four checkpoints into the `weights/` directory
|
|
|
|
| 83 |
|
| 84 |
```python
|
| 85 |
-
|
|
|
|
|
|
|
| 86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
snapshot_download(
|
| 88 |
-
repo_id="
|
| 89 |
-
local_dir="weights",
|
| 90 |
-
allow_patterns=[
|
| 91 |
-
"gfm_3d.pth",
|
| 92 |
-
"gfm_3d_camera_cond.pth",
|
| 93 |
-
"gfm_4d.pth",
|
| 94 |
-
"mvloma.pth",
|
| 95 |
-
],
|
| 96 |
)
|
| 97 |
```
|
| 98 |
|
| 99 |
-
To download
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
See the [Hugging Face download guide](https://huggingface.co/docs/huggingface_hub/en/guides/download)
|
| 101 |
for authentication and download options.
|
| 102 |
|
|
|
|
| 79 |
|
| 80 |
### Download Checkpoints
|
| 81 |
|
| 82 |
+
Download all four checkpoints into the `weights/` directory. The checkpoint
|
| 83 |
+
manifest maps each inference configuration to its required weight files:
|
| 84 |
|
| 85 |
```python
|
| 86 |
+
import json
|
| 87 |
+
from pathlib import Path
|
| 88 |
+
from huggingface_hub import hf_hub_download, snapshot_download
|
| 89 |
|
| 90 |
+
repo_id = "KosmoResearch/Kosmo-GFM"
|
| 91 |
+
config_path = hf_hub_download(
|
| 92 |
+
repo_id=repo_id, filename="config.json", local_dir="weights"
|
| 93 |
+
)
|
| 94 |
+
config = json.loads(Path(config_path).read_text())
|
| 95 |
+
|
| 96 |
+
selected_models = list(config["models"]) # All inference configurations.
|
| 97 |
+
# For GFM + MVLoMA only: selected_models = ["gfm_3d_with_mvloma"]
|
| 98 |
+
checkpoints = sorted({
|
| 99 |
+
filename
|
| 100 |
+
for name in selected_models
|
| 101 |
+
for filename in config["models"][name]["checkpoints"]
|
| 102 |
+
})
|
| 103 |
snapshot_download(
|
| 104 |
+
repo_id=repo_id, local_dir="weights", allow_patterns=checkpoints
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
)
|
| 106 |
```
|
| 107 |
|
| 108 |
+
To download a subset, set `selected_models` to any of `gfm_3d`,
|
| 109 |
+
`gfm_3d_camera_cond`, `gfm_4d`, or `gfm_3d_with_mvloma`.
|
| 110 |
+
The MVLoMA configuration includes both `gfm_3d.pth` and `mvloma.pth`.
|
| 111 |
+
[`config.json`](config.json) is a checkpoint manifest for the standalone GFM
|
| 112 |
+
scripts; it is not a Transformers `AutoModel` configuration.
|
| 113 |
+
|
| 114 |
See the [Hugging Face download guide](https://huggingface.co/docs/huggingface_hub/en/guides/download)
|
| 115 |
for authentication and download options.
|
| 116 |
|
config.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": 1,
|
| 3 |
+
"description": "Checkpoint manifest for the Kosmo-GFM standalone inference scripts.",
|
| 4 |
+
"models": {
|
| 5 |
+
"gfm_3d": {
|
| 6 |
+
"checkpoints": [
|
| 7 |
+
"gfm_3d.pth"
|
| 8 |
+
],
|
| 9 |
+
"inference_script": "tools/infer_3d.py"
|
| 10 |
+
},
|
| 11 |
+
"gfm_3d_camera_cond": {
|
| 12 |
+
"checkpoints": [
|
| 13 |
+
"gfm_3d_camera_cond.pth"
|
| 14 |
+
],
|
| 15 |
+
"inference_script": "tools/infer_3d_camera_cond.py"
|
| 16 |
+
},
|
| 17 |
+
"gfm_4d": {
|
| 18 |
+
"checkpoints": [
|
| 19 |
+
"gfm_4d.pth"
|
| 20 |
+
],
|
| 21 |
+
"inference_script": "tools/infer_4d.py"
|
| 22 |
+
},
|
| 23 |
+
"gfm_3d_with_mvloma": {
|
| 24 |
+
"checkpoints": [
|
| 25 |
+
"gfm_3d.pth",
|
| 26 |
+
"mvloma.pth"
|
| 27 |
+
],
|
| 28 |
+
"inference_script": "tools/infer_3d_with_mvloma.py"
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
}
|