Update verified WDS index (2 shards)
Browse files- README.md +4 -1
- manifest.json +1 -1
- reader.py +13 -6
- urls/train.txt +1 -0
README.md
CHANGED
|
@@ -56,7 +56,10 @@ annotations. Metadata never requires remote pickle execution.
|
|
| 56 |
training loader, preserving camera/depth corrections. Use it alongside the
|
| 57 |
SpatialEncoder checkout and its dependencies (WebDataset, torch, OpenCV,
|
| 58 |
Pillow, numpy, h5py, protobuf, etc.). Linux is required for its memory-backed
|
| 59 |
-
seekable asset handles.
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
```python
|
| 62 |
import webdataset as wds
|
|
|
|
| 56 |
training loader, preserving camera/depth corrections. Use it alongside the
|
| 57 |
SpatialEncoder checkout and its dependencies (WebDataset, torch, OpenCV,
|
| 58 |
Pillow, numpy, h5py, protobuf, etc.). Linux is required for its memory-backed
|
| 59 |
+
seekable asset handles. HDF5 additionally needs one sequence-sized temporary
|
| 60 |
+
file per active worker, deleted after decoding; set `SPATIAL_WDS_TMPDIR` to a
|
| 61 |
+
local SSD or sufficiently large tmpfs. No original source directories or
|
| 62 |
+
whole-shard downloads are needed.
|
| 63 |
|
| 64 |
```python
|
| 65 |
import webdataset as wds
|
manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"schema": "spatialencoder-wds-native-v1", "release": "wds_v20260913", "repo": "xxxspatialencoderwds2/data_2", "status": "uploading", "shards": [{"schema": "spatialencoder-wds-native-v1", "dataset": "HSSD", "split": "train", "shard_index": 1, "file": "hssd-train-000001.tar", "bytes": 1044736000, "sha256": "0aed8da5b8f4cb14c140e92f1ee7ed9e41db1569768eb23ae1603802a3cac4a2", "samples": 34, "frames": 204, "repo": "xxxspatialencoderwds2/data_2", "path": "wds_v20260913/HSSD/hssd-train-000001.tar", "commit": "6f5ad487ae9c6c36e5e56d37aff246af2f422b86", "verified_at": 1789348674.290689, "url": "https://huggingface.co/datasets/xxxspatialencoderwds2/data_2/resolve/6f5ad487ae9c6c36e5e56d37aff246af2f422b86/wds_v20260913/HSSD/hssd-train-000001.tar"}], "updated_at":
|
|
|
|
| 1 |
+
{"schema": "spatialencoder-wds-native-v1", "release": "wds_v20260913", "repo": "xxxspatialencoderwds2/data_2", "status": "uploading", "shards": [{"schema": "spatialencoder-wds-native-v1", "dataset": "CA-1M", "split": "train", "shard_index": 0, "file": "ca_1m-train-000000.tar", "bytes": 1042227200, "sha256": "a1a71ab72304c690af08c35d8823a9337630fc8be2a8e442d2fcc24181e66cc7", "samples": 17, "frames": 1274, "repo": "xxxspatialencoderwds2/data_2", "path": "wds_v20260913/CA-1M/ca_1m-train-000000.tar", "commit": "a8d90972c890d03c6a5b0874686452fc9b2263e2", "verified_at": 1789348901.6397967, "url": "https://huggingface.co/datasets/xxxspatialencoderwds2/data_2/resolve/a8d90972c890d03c6a5b0874686452fc9b2263e2/wds_v20260913/CA-1M/ca_1m-train-000000.tar"}, {"schema": "spatialencoder-wds-native-v1", "dataset": "HSSD", "split": "train", "shard_index": 1, "file": "hssd-train-000001.tar", "bytes": 1044736000, "sha256": "0aed8da5b8f4cb14c140e92f1ee7ed9e41db1569768eb23ae1603802a3cac4a2", "samples": 34, "frames": 204, "repo": "xxxspatialencoderwds2/data_2", "path": "wds_v20260913/HSSD/hssd-train-000001.tar", "commit": "6f5ad487ae9c6c36e5e56d37aff246af2f422b86", "verified_at": 1789348674.290689, "url": "https://huggingface.co/datasets/xxxspatialencoderwds2/data_2/resolve/6f5ad487ae9c6c36e5e56d37aff246af2f422b86/wds_v20260913/HSSD/hssd-train-000001.tar"}], "updated_at": 1789348901.7521486}
|
reader.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
"""S3/HTTPS WebDataset consumer using SpatialEncoder's native geometry code.
|
| 2 |
|
| 3 |
-
Shards stream through WebDataset; only the current sample
|
| 4 |
-
Linux memfd handles allow existing PIL/OpenCV
|
| 5 |
-
|
| 6 |
Install this module alongside the matching SpatialEncoder checkout.
|
| 7 |
"""
|
| 8 |
from __future__ import annotations
|
|
@@ -37,9 +37,9 @@ def header_of(sample):
|
|
| 37 |
|
| 38 |
@contextmanager
|
| 39 |
def memory_assets(sample):
|
| 40 |
-
"""Suffix-preserving
|
| 41 |
descriptors = []
|
| 42 |
-
with tempfile.TemporaryDirectory(prefix="spatial-wds-") as directory:
|
| 43 |
paths = {}
|
| 44 |
try:
|
| 45 |
for field, data in sample.items():
|
|
@@ -47,12 +47,19 @@ def memory_assets(sample):
|
|
| 47 |
continue
|
| 48 |
if not re.fullmatch(r"[a-zA-Z0-9_]+\.[a-zA-Z0-9]+", field):
|
| 49 |
raise ValueError(f"Unsafe asset field: {field}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
descriptor = os.memfd_create("spatial-wds", flags=os.MFD_CLOEXEC)
|
| 51 |
descriptors.append(descriptor)
|
| 52 |
view = memoryview(data)
|
| 53 |
while view:
|
| 54 |
view = view[os.write(descriptor, view):]
|
| 55 |
-
path = Path(directory) / field
|
| 56 |
path.symlink_to(f"/proc/{os.getpid()}/fd/{descriptor}")
|
| 57 |
paths[field] = str(path)
|
| 58 |
yield Path(directory), paths
|
|
|
|
| 1 |
"""S3/HTTPS WebDataset consumer using SpatialEncoder's native geometry code.
|
| 2 |
|
| 3 |
+
Shards stream through WebDataset; only the current sample is materialized.
|
| 4 |
+
Linux memfd handles allow existing PIL/OpenCV readers to seek inside a sample.
|
| 5 |
+
HDF5 requires a real path and uses a bounded per-sample temporary file instead.
|
| 6 |
Install this module alongside the matching SpatialEncoder checkout.
|
| 7 |
"""
|
| 8 |
from __future__ import annotations
|
|
|
|
| 37 |
|
| 38 |
@contextmanager
|
| 39 |
def memory_assets(sample):
|
| 40 |
+
"""Suffix-preserving handles; HDF5 alone needs a real temporary file."""
|
| 41 |
descriptors = []
|
| 42 |
+
with tempfile.TemporaryDirectory(prefix="spatial-wds-", dir=os.environ.get("SPATIAL_WDS_TMPDIR")) as directory:
|
| 43 |
paths = {}
|
| 44 |
try:
|
| 45 |
for field, data in sample.items():
|
|
|
|
| 47 |
continue
|
| 48 |
if not re.fullmatch(r"[a-zA-Z0-9_]+\.[a-zA-Z0-9]+", field):
|
| 49 |
raise ValueError(f"Unsafe asset field: {field}")
|
| 50 |
+
path = Path(directory) / field
|
| 51 |
+
if field.endswith(".h5"):
|
| 52 |
+
# HDF5's sec2 driver resolves realpath and rejects Linux
|
| 53 |
+
# anonymous memfd objects. Cache only this sequence, not
|
| 54 |
+
# the shard; the context always removes it after decoding.
|
| 55 |
+
path.write_bytes(data)
|
| 56 |
+
paths[field] = str(path)
|
| 57 |
+
continue
|
| 58 |
descriptor = os.memfd_create("spatial-wds", flags=os.MFD_CLOEXEC)
|
| 59 |
descriptors.append(descriptor)
|
| 60 |
view = memoryview(data)
|
| 61 |
while view:
|
| 62 |
view = view[os.write(descriptor, view):]
|
|
|
|
| 63 |
path.symlink_to(f"/proc/{os.getpid()}/fd/{descriptor}")
|
| 64 |
paths[field] = str(path)
|
| 65 |
yield Path(directory), paths
|
urls/train.txt
CHANGED
|
@@ -1 +1,2 @@
|
|
|
|
|
| 1 |
https://huggingface.co/datasets/xxxspatialencoderwds2/data_2/resolve/6f5ad487ae9c6c36e5e56d37aff246af2f422b86/wds_v20260913/HSSD/hssd-train-000001.tar
|
|
|
|
| 1 |
+
https://huggingface.co/datasets/xxxspatialencoderwds2/data_2/resolve/a8d90972c890d03c6a5b0874686452fc9b2263e2/wds_v20260913/CA-1M/ca_1m-train-000000.tar
|
| 2 |
https://huggingface.co/datasets/xxxspatialencoderwds2/data_2/resolve/6f5ad487ae9c6c36e5e56d37aff246af2f422b86/wds_v20260913/HSSD/hssd-train-000001.tar
|