bardofcodes commited on
Commit
4cf20ea
·
verified ·
1 Parent(s): f7d0665

Add files using upload-large-folder tool

Browse files
.gitattributes CHANGED
@@ -25,3 +25,6 @@
25
  *.md text
26
  *.txt text
27
  *.py text eol=lf
 
 
 
 
25
  *.md text
26
  *.txt text
27
  *.py text eol=lf
28
+ dataset/partobjaverse/superfrustum/b7fce3003d95479a9226f7cb639df893/primitive_assembly_explode_pause_fit_back.mp4 filter=lfs diff=lfs merge=lfs -text
29
+ dataset/partobjaverse/superfrustum/b7fce3003d95479a9226f7cb639df893/primitive_assembly_spiral.mp4 filter=lfs diff=lfs merge=lfs -text
30
+ dataset/partobjaverse/superfrustum/b7fce3003d95479a9226f7cb639df893/primitive_assembly_explode_pause_fit_back_then_spiral.mp4 filter=lfs diff=lfs merge=lfs -text
LICENSE CHANGED
@@ -1,13 +1,19 @@
1
- Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
2
 
3
  Copyright (c) 2026 Aditya Ganeshan and the SuperFit authors.
4
 
5
- The materials in this repository (the "Dataset") including the primitive
6
- assembly artifacts, configuration files, evaluation summaries, manifests, and
7
- accompanying documentation — are released for non-commercial research use only.
8
- By accessing or using the Dataset, you agree to the terms of the Creative
9
- Commons Attribution-NonCommercial 4.0 International Public License
10
- ("CC BY-NC 4.0"), the full text of which is available at:
 
 
 
 
 
 
11
 
12
  https://creativecommons.org/licenses/by-nc/4.0/legalcode
13
 
@@ -16,8 +22,8 @@ Summary of permissions and conditions
16
 
17
  You are free to:
18
 
19
- - Share copy and redistribute the Dataset in any medium or format.
20
- - Adapt remix, transform, and build upon the Dataset.
21
 
22
  Under the following terms:
23
 
@@ -44,11 +50,11 @@ or in part, requires prior written permission from the authors.
44
  Third-party assets
45
  ------------------
46
 
47
- The Dataset is *derived* from publicly available 3D shape benchmarks
48
- (Toys4K and PartObjaverse / Objaverse). The terms above govern the derived
49
- artifacts authored by the SuperFit team. The original 3D meshes are NOT
50
- redistributed in this repository and remain subject to their own licenses and
51
- access requirements:
52
 
53
  - Toys4K: <https://rehg.org/publication/dataset2/> (request via the
54
  authors' form).
@@ -58,8 +64,8 @@ access requirements:
58
  Users must independently comply with those upstream terms when obtaining or
59
  using the source meshes.
60
 
61
- Disclaimer
62
- ----------
63
 
64
  THE DATASET IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
65
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
@@ -68,3 +74,46 @@ SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR
68
  OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE,
69
  ARISING FROM, OUT OF, OR IN CONNECTION WITH THE DATASET OR THE USE OR OTHER
70
  DEALINGS IN THE DATASET.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ SuperFit Primitive Assembly Release License
2
 
3
  Copyright (c) 2026 Aditya Ganeshan and the SuperFit authors.
4
 
5
+ This release uses separate licenses for dataset materials and release helper
6
+ code.
7
+
8
+ 1. Dataset Materials and Documentation: CC BY-NC 4.0
9
+ ----------------------------------------------------
10
+
11
+ The dataset materials in this repository (the "Dataset") - including primitive
12
+ assembly artifacts, configuration files, evaluation summaries, manifests,
13
+ metadata, provenance notes, and accompanying documentation - are released for
14
+ non-commercial research use only under the Creative Commons
15
+ Attribution-NonCommercial 4.0 International Public License ("CC BY-NC 4.0").
16
+ The full text is available at:
17
 
18
  https://creativecommons.org/licenses/by-nc/4.0/legalcode
19
 
 
22
 
23
  You are free to:
24
 
25
+ - Share - copy and redistribute the Dataset in any medium or format.
26
+ - Adapt - remix, transform, and build upon the Dataset.
27
 
28
  Under the following terms:
29
 
 
50
  Third-party assets
51
  ------------------
52
 
53
+ The Dataset is derived from public 3D shape benchmarks (Toys4K and
54
+ PartObjaverse / Objaverse). The terms above govern the derived artifacts
55
+ authored by the SuperFit team. The original 3D meshes are NOT redistributed in
56
+ this repository and remain subject to their own licenses and access
57
+ requirements:
58
 
59
  - Toys4K: <https://rehg.org/publication/dataset2/> (request via the
60
  authors' form).
 
64
  Users must independently comply with those upstream terms when obtaining or
65
  using the source meshes.
66
 
67
+ Disclaimer for Dataset Materials
68
+ --------------------------------
69
 
70
  THE DATASET IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
71
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
74
  OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE,
75
  ARISING FROM, OUT OF, OR IN CONNECTION WITH THE DATASET OR THE USE OR OTHER
76
  DEALINGS IN THE DATASET.
77
+
78
+
79
+ 2. Release Helper Code: MIT License
80
+ -----------------------------------
81
+
82
+ The small release helper scripts in this repository are licensed under the MIT
83
+ License. This includes:
84
+
85
+ - load_release.py
86
+ - examples/*.py
87
+ - scripts/*.py
88
+
89
+ These helpers are provided for dataset discovery, loading examples, manifest
90
+ maintenance, and validation. They do not include or relicense the SuperFit
91
+ codebase.
92
+
93
+ MIT License
94
+
95
+ Permission is hereby granted, free of charge, to any person obtaining a copy
96
+ of the release helper code (the "Software"), to deal in the Software without
97
+ restriction, including without limitation the
98
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
99
+ sell copies of the Software, subject to the following conditions:
100
+
101
+ The above copyright notice and this permission notice shall be included in all
102
+ copies or substantial portions of the Software.
103
+
104
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
105
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
106
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
107
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
108
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
109
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
110
+ SOFTWARE.
111
+
112
+
113
+ 3. SuperFit Codebase
114
+ --------------------
115
+
116
+ The SuperFit codebase itself is not part of this dataset license grant.
117
+ SuperFit is distributed separately under its own license; see:
118
+
119
+ https://github.com/BardOfCodes/superfit
README.md CHANGED
@@ -37,7 +37,9 @@ configs:
37
 
38
  Pre-computed **primitive assemblies** produced by [SuperFit](https://github.com/BardOfCodes/superfit) (CVPR 2026) on two public 3D shape benchmarks. Each instance stores the fitted primitive parameters, optimization statistics, and optional per-instance evaluation metrics as serialized Python pickles alongside the hyperparameter `config.json` used for fitting.
39
 
40
- > **Intended use:** This release is provided **for non-commercial research use only** under the [CC BY-NC 4.0](LICENSE) license. Source 3D meshes are **not** redistributed here; you must obtain [Toys4K](https://rehg.org/publication/dataset2/) and [PartObjaverse](https://partobjaverse.github.io/) / [Objaverse](https://objaverse.allenai.org/) under their respective terms before comparing to ground-truth geometry. Commercial use of this Dataset, in whole or in part, requires prior written permission from the authors.
 
 
41
 
42
  ## Dataset structure
43
 
@@ -45,7 +47,7 @@ Pre-computed **primitive assemblies** produced by [SuperFit](https://github.com/
45
  sf_release/
46
  ├── manifest.jsonl # one row per (subset, method, object)
47
  ├── metadata.json # counts and schema summary
48
- ├── load_release.py # stdlib manifest loader
49
  ├── scripts/ # build, sanitize, validate (maintainers)
50
  ├── examples/ # usage examples
51
  └── dataset/ # primitive-assembly artifacts
@@ -93,9 +95,9 @@ Method-level aggregates (where present):
93
 
94
  ### Pickle schema
95
 
96
- `primitive_assembly.pkl` is a **nested Python `dict`** produced by SuperFit's statistics manager. Keys are dot-separated paths (e.g. `evaluation.iou@128`, `input_mesh_file`, timing scopes). Values are floats, strings, NumPy arrays, nested dicts, or serialized expression metadata. **Loading requires Python 3.10+** and typically **PyTorch** / **NumPy** because tensors may be embedded.
97
 
98
- See the [SuperFit repository](https://github.com/BardOfCodes/superfit) for code that consumes these artifacts.
99
 
100
  ### Pickle safety
101
 
@@ -114,7 +116,7 @@ cd superfit-primitive-assemblies
114
  git lfs pull
115
  ```
116
 
117
- ### Manifest loader (stdlib only)
118
 
119
  ```python
120
  from pathlib import Path
@@ -125,7 +127,23 @@ print(load_metadata(root)["total_instances"]) # 6700
125
 
126
  index = ReleaseIndex(root)
127
  row = index.get("toys4k", "superfrustum", "airplane_002")
128
- assembly = index.load(row) # pickle — trusted source only
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  print(type(assembly), list(assembly.keys())[:5])
130
  ```
131
 
@@ -136,6 +154,55 @@ python examples/load_artifact.py --source toys4k --method cuboid --object-id air
136
  python examples/load_artifact.py --source partobjaverse --method superfrustum --artifact eval
137
  ```
138
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  ### Rebuild manifest / validate before upload
140
 
141
  Maintainers can regenerate indexes and run checks from the repo root:
@@ -152,20 +219,22 @@ python scripts/validate_release.py
152
  - **Not a Parquet/Arrow dataset:** the Hugging Face Dataset Viewer will not render pickle contents; use `manifest.jsonl` for discovery.
153
  - **No source meshes:** only fitted assemblies and configs are provided.
154
  - **Incomplete eval coverage:** `dataset/toys4k/superfrustum` has per-instance eval pickles on a subset of instances; see `has_primitive_assembly_eval` in the manifest.
155
- - **Environment coupling:** unpickling may require the SuperFit stack even though the manifest loader itself is stdlib-only.
156
 
157
  ## Licensing and provenance
158
 
159
  | Component | License / terms |
160
  |-----------|-----------------|
161
- | **This release** (assemblies, configs, manifests) | [CC BY-NC 4.0](LICENSE) non-commercial research use only |
 
 
162
  | **Toys4K** source meshes | Request access via the [authors' form](https://forms.gle/w7Zf82umwaKxr9L7A); follow their terms |
163
  | **PartObjaverse** (`dataset/partobjaverse/`) | Derived from [SAMPart3D](https://arxiv.org/abs/2411.07184) / Objaverse assets; cite Yang et al. (2024) below |
164
  | **Objaverse** source meshes | Per-object licenses (CC-BY, CC-BY-NC, etc.); see [Objaverse](https://objaverse.allenai.org/) |
165
 
166
  We recommend publishing this Hugging Face repo as **gated** until you confirm redistribution of derived fits is compatible with your Toys4K and Objaverse agreements.
167
 
168
- Details: [PROVENANCE.md](PROVENANCE.md).
169
 
170
  ## Citation
171
 
 
37
 
38
  Pre-computed **primitive assemblies** produced by [SuperFit](https://github.com/BardOfCodes/superfit) (CVPR 2026) on two public 3D shape benchmarks. Each instance stores the fitted primitive parameters, optimization statistics, and optional per-instance evaluation metrics as serialized Python pickles alongside the hyperparameter `config.json` used for fitting.
39
 
40
+ The manifest files can be inspected with standard-library Python only. Loading primitive-assembly pickles, recovering expressions, or generating meshes requires the [SuperFit codebase](https://github.com/BardOfCodes/superfit) and its runtime dependencies.
41
+
42
+ > **Intended use:** The dataset materials in this release are provided **for non-commercial research use only** under [CC BY-NC 4.0](LICENSE). The small release helper scripts are MIT-licensed; see [LICENSE](LICENSE) for scope. Source 3D meshes are **not** redistributed here; you must obtain [Toys4K](https://rehg.org/publication/dataset2/) and [PartObjaverse](https://partobjaverse.github.io/) / [Objaverse](https://objaverse.allenai.org/) under their respective terms before comparing to ground-truth geometry. Commercial use of this Dataset, in whole or in part, requires prior written permission from the authors.
43
 
44
  ## Dataset structure
45
 
 
47
  sf_release/
48
  ├── manifest.jsonl # one row per (subset, method, object)
49
  ├── metadata.json # counts and schema summary
50
+ ├── load_release.py # stdlib manifest index + pickle helper
51
  ├── scripts/ # build, sanitize, validate (maintainers)
52
  ├── examples/ # usage examples
53
  └── dataset/ # primitive-assembly artifacts
 
95
 
96
  ### Pickle schema
97
 
98
+ `primitive_assembly.pkl` is a **flat Python `dict`** produced by SuperFit's statistics manager. Keys are dot-separated paths (e.g. `iter_0.pruned_program`, `evaluation.iou@128`, `input_mesh_file`, timing scopes). Values are floats, strings, NumPy arrays, PyTorch tensors, nested dicts, or serialized SuperFit / GeoLIPI expression metadata. **Loading primitive assemblies requires Python 3.10+ and usually the SuperFit runtime**, including PyTorch / NumPy and the expression classes used by the saved programs.
99
 
100
+ See the [SuperFit repository](https://github.com/BardOfCodes/superfit) for the supported runtime and code that consumes these artifacts.
101
 
102
  ### Pickle safety
103
 
 
116
  git lfs pull
117
  ```
118
 
119
+ ### Manifest discovery (stdlib only)
120
 
121
  ```python
122
  from pathlib import Path
 
127
 
128
  index = ReleaseIndex(root)
129
  row = index.get("toys4k", "superfrustum", "airplane_002")
130
+ print(row["primitive_assembly_path"])
131
+ ```
132
+
133
+ ### Loading artifacts (requires SuperFit runtime)
134
+
135
+ Primitive assemblies are Python pickles. Unpickling them can require SuperFit,
136
+ PyTorch, NumPy, and expression dependencies from the
137
+ [SuperFit repository](https://github.com/BardOfCodes/superfit):
138
+
139
+ ```python
140
+ from pathlib import Path
141
+ from load_release import ReleaseIndex
142
+
143
+ root = Path(".")
144
+ index = ReleaseIndex(root)
145
+ row = index.get("toys4k", "superfrustum", "airplane_002")
146
+ assembly = index.load(row) # trusted pickle; requires SuperFit/PyTorch stack
147
  print(type(assembly), list(assembly.keys())[:5])
148
  ```
149
 
 
154
  python examples/load_artifact.py --source partobjaverse --method superfrustum --artifact eval
155
  ```
156
 
157
+ ### Export a mesh with SuperFit
158
+
159
+ The released files store primitive expressions, not pre-meshed OBJ/GLB files.
160
+ To generate a mesh, install or add [SuperFit](https://github.com/BardOfCodes/superfit)
161
+ to your Python environment, load a saved expression, evaluate it as an SDF, and
162
+ use SuperFit's mesh extraction helper:
163
+
164
+ ```python
165
+ from pathlib import Path
166
+
167
+ from geolipi.torch_compute import Sketcher, recursive_evaluate
168
+ from load_release import ReleaseIndex
169
+ from superfit.symbolic.utils import fetch_singular_expr_eval
170
+ from superfit.utils.io import get_best_expr
171
+ from superfit.utils.mesh_sdf import sdf_to_mesh
172
+
173
+ root = Path(".")
174
+ index = ReleaseIndex(root)
175
+ row = index.get("toys4k", "superfrustum", "airplane_002")
176
+ info = index.load(row) # trusted pickle; requires SuperFit runtime
177
+
178
+ expr = get_best_expr(info, prog_type="pruned_program")
179
+ expr = fetch_singular_expr_eval(
180
+ expr.tensor(device="cuda"),
181
+ temperature=10000.0,
182
+ relaxed_eval=True,
183
+ remove_marker=True,
184
+ device="cuda",
185
+ )
186
+
187
+ sketcher = Sketcher(resolution=128, n_dims=3, device="cuda")
188
+ sdf = recursive_evaluate(expr.tensor(device="cuda"), sketcher)
189
+ mesh = sdf_to_mesh(sdf, sketcher)
190
+ mesh.export("airplane_002.obj")
191
+ ```
192
+
193
+ The same flow is available as:
194
+
195
+ ```bash
196
+ python examples/export_mesh_with_superfit.py \
197
+ --source toys4k \
198
+ --method superfrustum \
199
+ --object-id airplane_002 \
200
+ --output airplane_002.obj
201
+ ```
202
+
203
+ SuperFit's current mesh extraction path uses PyTorch/Kaolin/FlexiCubes and is
204
+ normally run on CUDA.
205
+
206
  ### Rebuild manifest / validate before upload
207
 
208
  Maintainers can regenerate indexes and run checks from the repo root:
 
219
  - **Not a Parquet/Arrow dataset:** the Hugging Face Dataset Viewer will not render pickle contents; use `manifest.jsonl` for discovery.
220
  - **No source meshes:** only fitted assemblies and configs are provided.
221
  - **Incomplete eval coverage:** `dataset/toys4k/superfrustum` has per-instance eval pickles on a subset of instances; see `has_primitive_assembly_eval` in the manifest.
222
+ - **Environment coupling:** manifest discovery is stdlib-only, but unpickling primitive assemblies, recovering expressions, and exporting meshes require the SuperFit stack.
223
 
224
  ## Licensing and provenance
225
 
226
  | Component | License / terms |
227
  |-----------|-----------------|
228
+ | **Dataset materials** (assemblies, configs, eval summaries, manifests, metadata, docs) | [CC BY-NC 4.0](LICENSE) - non-commercial research use only |
229
+ | **Release helper code** (`load_release.py`, `examples/*.py`, `scripts/*.py`) | [MIT](LICENSE) |
230
+ | **SuperFit codebase** | Distributed separately under its own license; see [SuperFit](https://github.com/BardOfCodes/superfit) |
231
  | **Toys4K** source meshes | Request access via the [authors' form](https://forms.gle/w7Zf82umwaKxr9L7A); follow their terms |
232
  | **PartObjaverse** (`dataset/partobjaverse/`) | Derived from [SAMPart3D](https://arxiv.org/abs/2411.07184) / Objaverse assets; cite Yang et al. (2024) below |
233
  | **Objaverse** source meshes | Per-object licenses (CC-BY, CC-BY-NC, etc.); see [Objaverse](https://objaverse.allenai.org/) |
234
 
235
  We recommend publishing this Hugging Face repo as **gated** until you confirm redistribution of derived fits is compatible with your Toys4K and Objaverse agreements.
236
 
237
+ This dataset release is **not** licensed under the Adobe Research License; that license applies to the separate SuperFit codebase. Details on source datasets and release posture: [PROVENANCE.md](PROVENANCE.md).
238
 
239
  ## Citation
240
 
dataset/partobjaverse/superfrustum/b7fce3003d95479a9226f7cb639df893/primitive_assembly_explode_pause_fit_back.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9debe81b7edc0dbf2fb501525a11ffbc53adb7ff28eb24dd339fb4ffacea6e64
3
+ size 382364
dataset/partobjaverse/superfrustum/b7fce3003d95479a9226f7cb639df893/primitive_assembly_explode_pause_fit_back_then_spiral.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:298fd098531b0d7f1ceb6a6f3cd236fb981088fc9e1780b56b87a56a949abf6a
3
+ size 1390167
dataset/partobjaverse/superfrustum/b7fce3003d95479a9226f7cb639df893/primitive_assembly_spiral.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:74467e826acfa63b07024f2a6a64126fdc40620760fa497397b06a993e42402c
3
+ size 1035731
examples/export_mesh_with_superfit.py ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Example: export a reconstructed mesh from a released primitive assembly.
3
+
4
+ This example requires the SuperFit runtime:
5
+
6
+ https://github.com/BardOfCodes/superfit
7
+
8
+ Run from the dataset repository root after installing SuperFit and its runtime
9
+ dependencies:
10
+
11
+ python examples/export_mesh_with_superfit.py \
12
+ --source toys4k \
13
+ --method superfrustum \
14
+ --object-id airplane_002 \
15
+ --output airplane_002.obj
16
+
17
+ The mesh path follows SuperFit's own export flow: load the released stats dict,
18
+ recover the saved primitive expression, evaluate it on a 3D grid, then convert
19
+ the SDF to a mesh with SuperFit's ``sdf_to_mesh`` helper.
20
+ """
21
+
22
+ from __future__ import annotations
23
+
24
+ import argparse
25
+ import pickle
26
+ import sys
27
+ from pathlib import Path
28
+ from typing import Any
29
+
30
+ # Allow `import load_release` when executed as `python examples/export_mesh_with_superfit.py`
31
+ _REPO_ROOT = Path(__file__).resolve().parent.parent
32
+ if str(_REPO_ROOT) not in sys.path:
33
+ sys.path.insert(0, str(_REPO_ROOT))
34
+
35
+ from load_release import ReleaseIndex # noqa: E402
36
+
37
+
38
+ def _import_superfit() -> tuple[Any, Any, Any, Any, Any]:
39
+ try:
40
+ from geolipi.torch_compute import Sketcher, recursive_evaluate
41
+ from superfit.symbolic.utils import fetch_singular_expr_eval
42
+ from superfit.utils.io import get_best_expr
43
+ from superfit.utils.mesh_sdf import sdf_to_mesh
44
+ except ImportError as exc:
45
+ raise SystemExit(
46
+ "This example requires SuperFit and its runtime dependencies. "
47
+ "Install or add SuperFit to PYTHONPATH; see "
48
+ "https://github.com/BardOfCodes/superfit"
49
+ ) from exc
50
+ return Sketcher, recursive_evaluate, fetch_singular_expr_eval, get_best_expr, sdf_to_mesh
51
+
52
+
53
+ def load_expression(
54
+ assembly_path: Path,
55
+ *,
56
+ program: str,
57
+ iter_idx: int | None,
58
+ temperature: float,
59
+ device: str,
60
+ ) -> Any:
61
+ _, _, fetch_singular_expr_eval, get_best_expr, _ = _import_superfit()
62
+ with assembly_path.open("rb") as fh:
63
+ info = pickle.load(fh)
64
+
65
+ expr = get_best_expr(info, iter_idx=iter_idx, prog_type=program)
66
+ return fetch_singular_expr_eval(
67
+ expr.tensor(device=device),
68
+ temperature=temperature,
69
+ relaxed_eval=True,
70
+ remove_marker=True,
71
+ device=device,
72
+ )
73
+
74
+
75
+ def export_mesh(expr: Any, output_path: Path, *, resolution: int, device: str) -> None:
76
+ Sketcher, recursive_evaluate, _, _, sdf_to_mesh = _import_superfit()
77
+ sketcher = Sketcher(resolution=resolution, n_dims=3, device=device)
78
+ sdf = recursive_evaluate(expr.tensor(device=device), sketcher)
79
+ mesh = sdf_to_mesh(sdf, sketcher)
80
+ output_path.parent.mkdir(parents=True, exist_ok=True)
81
+ mesh.export(output_path)
82
+
83
+
84
+ def main() -> None:
85
+ parser = argparse.ArgumentParser(description=__doc__)
86
+ parser.add_argument("--root", type=Path, default=_REPO_ROOT, help="Dataset repo root.")
87
+ parser.add_argument("--source", default="toys4k", choices=["toys4k", "partobjaverse"])
88
+ parser.add_argument("--method", default="superfrustum")
89
+ parser.add_argument("--object-id", required=True, help="Instance id to export.")
90
+ parser.add_argument(
91
+ "--program",
92
+ default="pruned_program",
93
+ help="Saved program key to export, e.g. pruned_program or best_program.",
94
+ )
95
+ parser.add_argument(
96
+ "--iter-idx",
97
+ type=int,
98
+ default=None,
99
+ help="Optimization iteration to read. Default: final iteration recorded in the artifact.",
100
+ )
101
+ parser.add_argument("--resolution", type=int, default=128, help="SDF grid resolution.")
102
+ parser.add_argument(
103
+ "--temperature",
104
+ type=float,
105
+ default=10000.0,
106
+ help="Temperature used when resolving stochastic primitive expressions.",
107
+ )
108
+ parser.add_argument(
109
+ "--device",
110
+ default="cuda",
111
+ help="Torch device for expression evaluation. SuperFit mesh export typically requires CUDA.",
112
+ )
113
+ parser.add_argument("--output", type=Path, required=True, help="Output mesh path, e.g. out.obj.")
114
+ args = parser.parse_args()
115
+
116
+ index = ReleaseIndex(args.root)
117
+ row = index.get(args.source, args.method, args.object_id)
118
+ assembly_path = index.artifact_path(row, "primitive_assembly")
119
+
120
+ expr = load_expression(
121
+ assembly_path,
122
+ program=args.program,
123
+ iter_idx=args.iter_idx,
124
+ temperature=args.temperature,
125
+ device=args.device,
126
+ )
127
+ export_mesh(expr, args.output, resolution=args.resolution, device=args.device)
128
+ print(f"Exported {args.output}")
129
+
130
+
131
+ if __name__ == "__main__":
132
+ main()
examples/load_artifact.py CHANGED
@@ -7,7 +7,11 @@ Run from the dataset repository root::
7
  python examples/load_artifact.py --source toys4k --method superfrustum --object-id airplane_002
8
  python examples/load_artifact.py --artifact eval
9
 
10
- Requires only the Python standard library plus ``load_release.py`` at the repo root.
 
 
 
 
11
  """
12
 
13
  from __future__ import annotations
 
7
  python examples/load_artifact.py --source toys4k --method superfrustum --object-id airplane_002
8
  python examples/load_artifact.py --artifact eval
9
 
10
+ Manifest discovery requires only the Python standard library plus
11
+ ``load_release.py`` at the repo root. Actually unpickling primitive assemblies
12
+ may require SuperFit, PyTorch, NumPy, and related runtime dependencies. See:
13
+
14
+ https://github.com/BardOfCodes/superfit
15
  """
16
 
17
  from __future__ import annotations
load_release.py CHANGED
@@ -1,17 +1,20 @@
1
  """Lightweight loader for the SuperFit primitive-assembly release.
2
 
3
  Reads ``manifest.jsonl`` at the repository root and provides helpers to filter
4
- rows and load pickle artifacts. No dependency on PyTorch or the SuperFit package.
 
 
 
5
 
6
  Example::
7
 
8
  from pathlib import Path
9
- from load_release import ReleaseIndex, load_pickle
10
 
11
  root = Path(".") # clone root of the Hugging Face dataset repo
12
  index = ReleaseIndex(root)
13
  rows = index.filter(source_dataset="toys4k", method="superfrustum", category="airplane")
14
- stats = load_pickle(root / rows[0]["primitive_assembly_path"])
15
  """
16
 
17
  from __future__ import annotations
@@ -121,7 +124,10 @@ class ReleaseIndex:
121
 
122
 
123
  def load_pickle(path: str | Path) -> Any:
124
- """Load a pickle file. Only unpickle artifacts you trust."""
 
 
 
125
  with Path(path).open("rb") as fh:
126
  return pickle.load(fh)
127
 
 
1
  """Lightweight loader for the SuperFit primitive-assembly release.
2
 
3
  Reads ``manifest.jsonl`` at the repository root and provides helpers to filter
4
+ rows and resolve artifact paths. Manifest discovery has no dependency on
5
+ PyTorch or the SuperFit package. Loading pickle artifacts may require SuperFit,
6
+ PyTorch, NumPy, and related runtime dependencies because serialized tensors and
7
+ primitive-expression objects can be embedded in the pickle payloads.
8
 
9
  Example::
10
 
11
  from pathlib import Path
12
+ from load_release import ReleaseIndex
13
 
14
  root = Path(".") # clone root of the Hugging Face dataset repo
15
  index = ReleaseIndex(root)
16
  rows = index.filter(source_dataset="toys4k", method="superfrustum", category="airplane")
17
+ print(index.artifact_path(rows[0], "primitive_assembly"))
18
  """
19
 
20
  from __future__ import annotations
 
124
 
125
 
126
  def load_pickle(path: str | Path) -> Any:
127
+ """Load a pickle file. Only unpickle artifacts you trust.
128
+
129
+ Primitive-assembly pickles may require the SuperFit runtime to be installed.
130
+ """
131
  with Path(path).open("rb") as fh:
132
  return pickle.load(fh)
133