vLAR commited on
Commit
0614c40
Β·
verified Β·
1 Parent(s): ec5b2a4

Add validation 3D asset download and setup guide

Browse files
PhysInOne Utils/3D_ASSETS_DOWNLOAD.md ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PhysInOne Validation 3D Assets
2
+
3
+ This guide explains how to download, extract, and open the public PhysInOne
4
+ validation 3D asset release. The release contains the Unreal Engine project
5
+ files and validation resources for 1,000 scenes.
6
+
7
+ Repository location:
8
+
9
+ [`3D Assets/PhysicBenchmark`](https://huggingface.co/datasets/vLAR/PhysInOne/tree/main/3D%20Assets/PhysicBenchmark)
10
+
11
+ ## Requirements
12
+
13
+ - Unreal Engine **5.5.4**
14
+ - Python 3.9 or newer for the automated downloader
15
+ - `huggingface_hub`; `tqdm` is recommended for progress display
16
+ - At least **50–60 GiB of free disk space** when keeping both ZIP files and
17
+ extracted assets
18
+
19
+ Windows is recommended for the simplest Unreal Engine setup. Linux is also
20
+ supported, but Unreal Engine installation, platform plugins, permissions, and
21
+ case-sensitive paths may require additional configuration.
22
+
23
+ ## Automated setup
24
+
25
+ Install the Python dependencies:
26
+
27
+ ```bash
28
+ pip install -U huggingface_hub tqdm
29
+ ```
30
+
31
+ Download the script, release lists, and this guide:
32
+
33
+ ```bash
34
+ hf download vLAR/PhysInOne \
35
+ "PhysInOne Utils/scripts/download_3d_assets.py" \
36
+ "PhysInOne Utils/3d_assets_lists/validation.txt" \
37
+ "PhysInOne Utils/3d_assets_lists/validation_archives.txt" \
38
+ "PhysInOne Utils/3d_assets_lists/summary.json" \
39
+ "PhysInOne Utils/3D_ASSETS_DOWNLOAD.md" \
40
+ --repo-type dataset \
41
+ --local-dir .
42
+ ```
43
+
44
+ Run the downloader:
45
+
46
+ ```bash
47
+ python "PhysInOne Utils/scripts/download_3d_assets.py" \
48
+ --output-dir ./PhysInOne-3D-Assets
49
+ ```
50
+
51
+ The default command performs all of the following:
52
+
53
+ 1. Downloads the exact validation release file list.
54
+ 2. Preserves the Hugging Face repository hierarchy.
55
+ 3. Validates ZIP paths and rejects unsafe archive members.
56
+ 4. Extracts all eight ZIP files into their correct parent directories.
57
+ 5. Merges scene and trajectory batches without overwriting different files.
58
+ 6. Writes resumable extraction markers and detailed success/failure logs.
59
+
60
+ After completion, the Unreal Engine project root is:
61
+
62
+ ```text
63
+ PhysInOne-3D-Assets/3D Assets/PhysicBenchmark/
64
+ ```
65
+
66
+ Open the project with Unreal Engine 5.5.4 by launching:
67
+
68
+ ```text
69
+ PhysInOne-3D-Assets/3D Assets/PhysicBenchmark/PhysInOne.uproject
70
+ ```
71
+
72
+ ## Download without extraction
73
+
74
+ To download the released files but keep every archive compressed:
75
+
76
+ ```bash
77
+ python "PhysInOne Utils/scripts/download_3d_assets.py" \
78
+ --output-dir ./PhysInOne-3D-Assets \
79
+ --no-extract
80
+ ```
81
+
82
+ You can run the default command later with the same output directory to extract
83
+ the archives.
84
+
85
+ ## Save disk space
86
+
87
+ To delete each ZIP only after it has been completely extracted and verified:
88
+
89
+ ```bash
90
+ python "PhysInOne Utils/scripts/download_3d_assets.py" \
91
+ --output-dir ./PhysInOne-3D-Assets \
92
+ --delete-zip-after-extract
93
+ ```
94
+
95
+ Completion markers prevent successfully extracted and deleted archives from
96
+ being downloaded again when the same command is resumed. Do not delete the
97
+ `.physinone_extract_status/` directories if this behavior is required.
98
+
99
+ ## Release contents
100
+
101
+ The current validation release contains:
102
+
103
+ - 4,299 downloadable files
104
+ - 8 ZIP archives
105
+ - Approximately 22.25 GiB of downloaded data
106
+ - Scene and trajectory resources for 1,000 validation scenes
107
+ - Shared Unreal Engine project content and dependencies required by the release
108
+
109
+ The exact maintained lists are available here:
110
+
111
+ - [`validation.txt`](https://huggingface.co/datasets/vLAR/PhysInOne/blob/main/PhysInOne%20Utils/3d_assets_lists/validation.txt): every released file
112
+ - [`validation_archives.txt`](https://huggingface.co/datasets/vLAR/PhysInOne/blob/main/PhysInOne%20Utils/3d_assets_lists/validation_archives.txt): the eight archives that must be extracted
113
+ - [`summary.json`](https://huggingface.co/datasets/vLAR/PhysInOne/blob/main/PhysInOne%20Utils/3d_assets_lists/summary.json): release counts and byte sizes
114
+
115
+ This is a validation release. The full training asset archives are not included
116
+ in this download list.
117
+
118
+ ## Archives and extraction destinations
119
+
120
+ Every ZIP must be extracted **in place**, meaning into the ZIP's current parent
121
+ directory. Do not extract all archives into one common folder.
122
+
123
+ | Archive, relative to `PhysicBenchmark/` | Extract in |
124
+ | --- | --- |
125
+ | `Content/PhysInOne/BackGrounds_raw/Val.zip` | `Content/PhysInOne/BackGrounds_raw/` |
126
+ | `Content/PhysInOne/BreakableObjects/Val.zip` | `Content/PhysInOne/BreakableObjects/` |
127
+ | `Content/PhysInOne/InteractableObjects/Val.zip` | `Content/PhysInOne/InteractableObjects/` |
128
+ | `Content/PhysInOne/MaterialsAppearance/Val.zip` | `Content/PhysInOne/MaterialsAppearance/` |
129
+ | `Content/PhysInOne/MaterialsPhysics/Val.zip` | `Content/PhysInOne/MaterialsPhysics/` |
130
+ | `Content/PhysInOne/SolidObjects/Val.zip` | `Content/PhysInOne/SolidObjects/` |
131
+ | `Content/PhysInOne/Scenes/val_scenes_batch_0000.zip` | `Content/PhysInOne/Scenes/` |
132
+ | `Content/PhysInOne/Trajectories/val_trajectory_batch_0000.zip` | `Content/PhysInOne/Trajectories/` |
133
+
134
+ The six `Val.zip` archives contain a top-level `Val/` folder. The scene and
135
+ trajectory batch archives also contain paths beginning with `Val/`. Extracting
136
+ each archive into its listed parent produces the correct Unreal Engine content
137
+ layout.
138
+
139
+ ## Expected project structure
140
+
141
+ After extraction, preserve the directory names and hierarchy exactly. In
142
+ particular, do not rename `BackGrounds_raw`, `__ExternalActors__`, or
143
+ `__ExternalObjects__`.
144
+
145
+ ```text
146
+ PhysicBenchmark/
147
+ β”œβ”€β”€ PhysInOne.uproject
148
+ β”œβ”€β”€ Config/
149
+ β”œβ”€β”€ DerivedDataCache/
150
+ └── Content/
151
+ β”œβ”€β”€ Collections/
152
+ β”œβ”€β”€ Ice/
153
+ β”œβ”€β”€ StarterContent/
154
+ β”œβ”€β”€ __ExternalActors__/
155
+ β”œβ”€β”€ __ExternalObjects__/
156
+ └── PhysInOne/
157
+ β”œβ”€β”€ Backgrounds/
158
+ β”œβ”€β”€ BackGrounds_raw/
159
+ β”‚ └── Val/
160
+ β”œβ”€β”€ BreakableObjects/
161
+ β”‚ └── Val/
162
+ β”œβ”€β”€ InteractableObjects/
163
+ β”‚ └── Val/
164
+ β”œβ”€β”€ MaterialsAppearance/
165
+ β”‚ └── Val/
166
+ β”œβ”€β”€ MaterialsPhysics/
167
+ β”‚ └── Val/
168
+ β”œβ”€β”€ Microsoft/
169
+ β”œβ”€β”€ SolidObjects/
170
+ β”‚ └── Val/
171
+ β”œβ”€β”€ Scenes/
172
+ β”‚ └── Val/
173
+ └── Trajectories/
174
+ └── Val/
175
+ ```
176
+
177
+ Unreal Engine resolves content by project-relative package paths. Changing this
178
+ layout can cause missing asset references or prevent levels from loading.
179
+
180
+ ## Resume and logs
181
+
182
+ The downloader is safe to run again with the same output directory. Completed
183
+ downloads are reused by `huggingface_hub`, existing identical extracted files
184
+ are retained, and archives with complete markers are skipped.
185
+
186
+ Logs are written to:
187
+
188
+ ```text
189
+ <output-dir>/_3d_asset_download_logs/YYYYMMDD_HHMMSS/
190
+ β”œβ”€β”€ downloads.tsv
191
+ β”œβ”€β”€ extraction.tsv
192
+ β”œβ”€β”€ failures.tsv
193
+ β”œβ”€β”€ events.jsonl
194
+ └── summary.json
195
+ ```
196
+
197
+ If a run is interrupted, execute the same command again and review
198
+ `failures.tsv` and `summary.json` after completion.
199
+
200
+ For a slower or rate-limited network, reduce concurrency:
201
+
202
+ ```bash
203
+ python "PhysInOne Utils/scripts/download_3d_assets.py" \
204
+ --output-dir ./PhysInOne-3D-Assets \
205
+ --workers 2
206
+ ```
207
+
208
+ Public downloads do not require a Hugging Face token. If authentication is
209
+ needed in a particular environment, set the standard `HF_TOKEN` environment
210
+ variable instead of placing a token in a script or log.
211
+
212
+ ## Contact
213
+
214
+ For setup questions, contact Siyuan Zhou at
215
+ `siyuan.zhou@connect.polyu.hk`. WeChat: `aify20001009`.
216
+
PhysInOne Utils/3d_assets_lists/summary.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bytes": 23895880477,
3
+ "files": 4299,
4
+ "release": "validation",
5
+ "remote_root": "3D Assets/PhysicBenchmark",
6
+ "repo_id": "vLAR/PhysInOne",
7
+ "scenes": 1000,
8
+ "zip_bytes": 21249298639,
9
+ "zip_files": 8
10
+ }
PhysInOne Utils/3d_assets_lists/validation.txt ADDED
The diff for this file is too large to render. See raw diff
 
PhysInOne Utils/3d_assets_lists/validation_archives.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ 3D Assets/PhysicBenchmark/Content/PhysInOne/BackGrounds_raw/Val.zip
2
+ 3D Assets/PhysicBenchmark/Content/PhysInOne/BreakableObjects/Val.zip
3
+ 3D Assets/PhysicBenchmark/Content/PhysInOne/InteractableObjects/Val.zip
4
+ 3D Assets/PhysicBenchmark/Content/PhysInOne/MaterialsAppearance/Val.zip
5
+ 3D Assets/PhysicBenchmark/Content/PhysInOne/MaterialsPhysics/Val.zip
6
+ 3D Assets/PhysicBenchmark/Content/PhysInOne/Scenes/val_scenes_batch_0000.zip
7
+ 3D Assets/PhysicBenchmark/Content/PhysInOne/SolidObjects/Val.zip
8
+ 3D Assets/PhysicBenchmark/Content/PhysInOne/Trajectories/val_trajectory_batch_0000.zip
PhysInOne Utils/scripts/download_3d_assets.py ADDED
@@ -0,0 +1,446 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Download and assemble the PhysInOne validation 3D asset project."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import argparse
7
+ import filecmp
8
+ import json
9
+ import os
10
+ import shutil
11
+ import stat
12
+ import sys
13
+ import threading
14
+ import zipfile
15
+ from concurrent.futures import ThreadPoolExecutor, as_completed
16
+ from dataclasses import dataclass
17
+ from datetime import datetime, timezone
18
+ from pathlib import Path, PurePosixPath
19
+ from typing import Sequence
20
+
21
+ try:
22
+ from huggingface_hub import hf_hub_download
23
+ except ImportError as exc: # pragma: no cover
24
+ raise SystemExit(
25
+ "Missing dependency: huggingface_hub. Install it with "
26
+ "`pip install -U huggingface_hub tqdm`."
27
+ ) from exc
28
+
29
+ try:
30
+ from tqdm import tqdm
31
+ except ImportError: # pragma: no cover
32
+ tqdm = None
33
+
34
+
35
+ REPO_ID = "vLAR/PhysInOne"
36
+ REPO_TYPE = "dataset"
37
+ REMOTE_ROOT = "3D Assets/PhysicBenchmark"
38
+ LIST_REPO_ROOT = "PhysInOne Utils/3d_assets_lists"
39
+ LOCAL_LIST_ROOT = Path(__file__).resolve().parent.parent / "3d_assets_lists"
40
+ FILE_LIST_NAME = "validation.txt"
41
+ ARCHIVE_LIST_NAME = "validation_archives.txt"
42
+ SUMMARY_NAME = "summary.json"
43
+
44
+
45
+ def utc_now() -> str:
46
+ return datetime.now(timezone.utc).isoformat(timespec="seconds")
47
+
48
+
49
+ def safe_message(exc: BaseException) -> str:
50
+ return " ".join(str(exc).replace("\t", " ").splitlines()).strip() or type(exc).__name__
51
+
52
+
53
+ def read_lines(path: Path) -> list[str]:
54
+ return [
55
+ line.strip()
56
+ for line in path.read_text(encoding="utf-8").splitlines()
57
+ if line.strip() and not line.lstrip().startswith("#")
58
+ ]
59
+
60
+
61
+ def get_release_file(name: str, revision: str, cache_dir: Path) -> Path:
62
+ local = LOCAL_LIST_ROOT / name
63
+ if local.is_file():
64
+ return local
65
+ return Path(
66
+ hf_hub_download(
67
+ REPO_ID,
68
+ f"{LIST_REPO_ROOT}/{name}",
69
+ repo_type=REPO_TYPE,
70
+ revision=revision,
71
+ cache_dir=cache_dir,
72
+ token=os.environ.get("HF_TOKEN") or None,
73
+ )
74
+ )
75
+
76
+
77
+ def load_release(revision: str, cache_dir: Path) -> tuple[list[str], list[str], dict]:
78
+ files = read_lines(get_release_file(FILE_LIST_NAME, revision, cache_dir))
79
+ archives = read_lines(get_release_file(ARCHIVE_LIST_NAME, revision, cache_dir))
80
+ summary = json.loads(
81
+ get_release_file(SUMMARY_NAME, revision, cache_dir).read_text(encoding="utf-8")
82
+ )
83
+ if not files or len(files) != len(set(files)) or files != sorted(files):
84
+ raise RuntimeError("the validation 3D asset file list is empty, duplicated, or unsorted")
85
+ if any(not path.startswith(REMOTE_ROOT + "/") for path in files):
86
+ raise RuntimeError("a release path is outside the expected PhysicBenchmark root")
87
+ if set(archives) != {path for path in files if path.lower().endswith(".zip")}:
88
+ raise RuntimeError("the archive list does not match the validation file list")
89
+ if any(PurePosixPath(path).name.casefold() == "train.zip" for path in files):
90
+ raise RuntimeError("the validation release unexpectedly contains Train.zip")
91
+ return files, archives, summary
92
+
93
+
94
+ def archive_marker(archive: Path) -> Path:
95
+ return archive.parent / ".physinone_extract_status" / f"{archive.name}.json"
96
+
97
+
98
+ def completed_removed_archive(archive: Path) -> bool:
99
+ marker = archive_marker(archive)
100
+ if archive.exists() or not marker.is_file():
101
+ return False
102
+ try:
103
+ state = json.loads(marker.read_text(encoding="utf-8"))
104
+ except (OSError, ValueError):
105
+ return False
106
+ return state.get("status") == "complete" and int(state.get("files", 0)) > 0
107
+
108
+
109
+ def safe_zip_members(archive: zipfile.ZipFile) -> list[zipfile.ZipInfo]:
110
+ members = archive.infolist()
111
+ for info in members:
112
+ path = PurePosixPath(info.filename)
113
+ mode = (info.external_attr >> 16) & 0o170000
114
+ if (
115
+ path.is_absolute()
116
+ or not path.parts
117
+ or any(part in {"", ".", ".."} for part in path.parts)
118
+ or mode == stat.S_IFLNK
119
+ ):
120
+ raise RuntimeError(f"unsafe ZIP member: {info.filename}")
121
+ return members
122
+
123
+
124
+ def members_complete(parent: Path, members: Sequence[zipfile.ZipInfo]) -> bool:
125
+ files = [info for info in members if not info.is_dir()]
126
+ return bool(files) and all(
127
+ (parent.joinpath(*PurePosixPath(info.filename).parts)).is_file()
128
+ and (parent.joinpath(*PurePosixPath(info.filename).parts)).stat().st_size
129
+ == info.file_size
130
+ for info in files
131
+ )
132
+
133
+
134
+ def merge_extracted_tree(temporary: Path, destination: Path) -> tuple[int, int]:
135
+ added = 0
136
+ reused = 0
137
+ for source in sorted(temporary.rglob("*")):
138
+ relative = source.relative_to(temporary)
139
+ target = destination / relative
140
+ if source.is_dir():
141
+ target.mkdir(parents=True, exist_ok=True)
142
+ continue
143
+ target.parent.mkdir(parents=True, exist_ok=True)
144
+ if target.exists():
145
+ if not target.is_file():
146
+ raise RuntimeError(f"extraction conflict with non-file path: {target}")
147
+ if source.stat().st_size != target.stat().st_size or not filecmp.cmp(
148
+ source, target, shallow=False
149
+ ):
150
+ raise RuntimeError(f"extraction would overwrite different data: {target}")
151
+ source.unlink()
152
+ reused += 1
153
+ else:
154
+ source.replace(target)
155
+ added += 1
156
+ return added, reused
157
+
158
+
159
+ def extract_archive(archive_path: Path) -> tuple[str, int, int]:
160
+ marker = archive_marker(archive_path)
161
+ with zipfile.ZipFile(archive_path) as archive:
162
+ members = safe_zip_members(archive)
163
+ files = [info for info in members if not info.is_dir()]
164
+ if members_complete(archive_path.parent, members):
165
+ marker.parent.mkdir(exist_ok=True)
166
+ marker.write_text(
167
+ json.dumps(
168
+ {
169
+ "archive": archive_path.name,
170
+ "archive_size": archive_path.stat().st_size,
171
+ "files": len(files),
172
+ "status": "complete",
173
+ "verified_at": utc_now(),
174
+ },
175
+ sort_keys=True,
176
+ )
177
+ + "\n",
178
+ encoding="utf-8",
179
+ )
180
+ return "already_extracted", 0, len(files)
181
+
182
+ temporary_root = archive_path.parent / ".physinone_extracting"
183
+ temporary = temporary_root / (
184
+ f"{archive_path.stem}-{os.getpid()}-{threading.get_ident()}"
185
+ )
186
+ if temporary.exists():
187
+ shutil.rmtree(temporary)
188
+ temporary.mkdir(parents=True)
189
+ try:
190
+ archive.extractall(temporary)
191
+ added, reused = merge_extracted_tree(temporary, archive_path.parent)
192
+ finally:
193
+ if temporary.exists():
194
+ shutil.rmtree(temporary)
195
+ if temporary_root.exists() and not any(temporary_root.iterdir()):
196
+ temporary_root.rmdir()
197
+
198
+ marker.parent.mkdir(exist_ok=True)
199
+ marker.write_text(
200
+ json.dumps(
201
+ {
202
+ "archive": archive_path.name,
203
+ "archive_size": archive_path.stat().st_size,
204
+ "files": len(files),
205
+ "status": "complete",
206
+ "verified_at": utc_now(),
207
+ },
208
+ sort_keys=True,
209
+ )
210
+ + "\n",
211
+ encoding="utf-8",
212
+ )
213
+ return "extracted", added, reused
214
+
215
+
216
+ @dataclass(frozen=True)
217
+ class DownloadResult:
218
+ remote_path: str
219
+ local_path: str
220
+ status: str
221
+ error: str = ""
222
+
223
+
224
+ class Logs:
225
+ def __init__(self, root: Path) -> None:
226
+ self.root = root
227
+ self.root.mkdir(parents=True, exist_ok=True)
228
+ self.downloads = root / "downloads.tsv"
229
+ self.failures = root / "failures.tsv"
230
+ self.extraction = root / "extraction.tsv"
231
+ self.events = root / "events.jsonl"
232
+ self._lock = threading.Lock()
233
+ self.downloads.write_text(
234
+ "remote_path\tlocal_path\tstatus\ttimestamp\n", encoding="utf-8"
235
+ )
236
+ self.failures.write_text(
237
+ "stage\tpath\terror\ttimestamp\n", encoding="utf-8"
238
+ )
239
+ self.extraction.write_text(
240
+ "archive\tstatus\tadded_files\treused_files\ttimestamp\n",
241
+ encoding="utf-8",
242
+ )
243
+
244
+ def event(self, event: str, **fields: object) -> None:
245
+ payload = {"event": event, "timestamp": utc_now(), **fields}
246
+ with self._lock, self.events.open("a", encoding="utf-8") as handle:
247
+ handle.write(json.dumps(payload, sort_keys=True) + "\n")
248
+
249
+ def record_download(self, result: DownloadResult) -> None:
250
+ timestamp = utc_now()
251
+ with self._lock:
252
+ if result.error:
253
+ with self.failures.open("a", encoding="utf-8") as handle:
254
+ handle.write(
255
+ f"download\t{result.remote_path}\t{result.error}\t{timestamp}\n"
256
+ )
257
+ else:
258
+ with self.downloads.open("a", encoding="utf-8") as handle:
259
+ handle.write(
260
+ f"{result.remote_path}\t{result.local_path}\t"
261
+ f"{result.status}\t{timestamp}\n"
262
+ )
263
+ self.event(
264
+ "download",
265
+ remote_path=result.remote_path,
266
+ local_path=result.local_path,
267
+ status=result.status,
268
+ error=result.error,
269
+ )
270
+
271
+ def record_extraction(
272
+ self, archive: str, status: str, added: int, reused: int, error: str = ""
273
+ ) -> None:
274
+ timestamp = utc_now()
275
+ with self._lock:
276
+ if error:
277
+ with self.failures.open("a", encoding="utf-8") as handle:
278
+ handle.write(f"extract\t{archive}\t{error}\t{timestamp}\n")
279
+ else:
280
+ with self.extraction.open("a", encoding="utf-8") as handle:
281
+ handle.write(
282
+ f"{archive}\t{status}\t{added}\t{reused}\t{timestamp}\n"
283
+ )
284
+ self.event(
285
+ "extraction",
286
+ archive=archive,
287
+ status=status,
288
+ added_files=added,
289
+ reused_files=reused,
290
+ error=error,
291
+ )
292
+
293
+
294
+ def download_one(
295
+ remote_path: str,
296
+ output_dir: Path,
297
+ cache_dir: Path,
298
+ revision: str,
299
+ skip_removed_archive: bool,
300
+ ) -> DownloadResult:
301
+ local_expected = output_dir.joinpath(*PurePosixPath(remote_path).parts)
302
+ if skip_removed_archive and completed_removed_archive(local_expected):
303
+ return DownloadResult(remote_path, str(local_expected), "extracted_zip_removed")
304
+ try:
305
+ local = hf_hub_download(
306
+ REPO_ID,
307
+ remote_path,
308
+ repo_type=REPO_TYPE,
309
+ revision=revision,
310
+ local_dir=output_dir,
311
+ cache_dir=cache_dir,
312
+ token=os.environ.get("HF_TOKEN") or None,
313
+ )
314
+ return DownloadResult(remote_path, str(local), "ready")
315
+ except Exception as exc:
316
+ return DownloadResult(remote_path, "", "failed", safe_message(exc))
317
+
318
+
319
+ def build_parser() -> argparse.ArgumentParser:
320
+ parser = argparse.ArgumentParser(
321
+ description="Download and assemble the PhysInOne validation 3D asset project."
322
+ )
323
+ parser.add_argument(
324
+ "--output-dir",
325
+ type=Path,
326
+ default=Path("PhysInOne-3D-Assets"),
327
+ help=(
328
+ "Local release root. The project will be stored at "
329
+ "<output-dir>/3D Assets/PhysicBenchmark."
330
+ ),
331
+ )
332
+ parser.add_argument(
333
+ "--workers", type=int, default=4, help="Concurrent downloads (default: 4)."
334
+ )
335
+ parser.add_argument("--revision", default="main", help="Dataset revision (default: main).")
336
+ parser.add_argument(
337
+ "--no-extract",
338
+ action="store_true",
339
+ help="Download the release without extracting its eight ZIP archives.",
340
+ )
341
+ parser.add_argument(
342
+ "--delete-zip-after-extract",
343
+ action="store_true",
344
+ help="Delete each ZIP only after it is completely extracted and verified.",
345
+ )
346
+ parser.add_argument(
347
+ "--dry-run", action="store_true", help="Show release statistics without downloading."
348
+ )
349
+ return parser
350
+
351
+
352
+ def main(argv: Sequence[str] | None = None) -> int:
353
+ args = build_parser().parse_args(argv)
354
+ if args.workers < 1:
355
+ raise SystemExit("--workers must be at least 1")
356
+ if args.no_extract and args.delete_zip_after_extract:
357
+ raise SystemExit("--delete-zip-after-extract cannot be combined with --no-extract")
358
+
359
+ output_dir = args.output_dir.expanduser().resolve()
360
+ cache_dir = output_dir / ".hf_cache"
361
+ files, archives, release_summary = load_release(args.revision, cache_dir)
362
+ print(
363
+ f"Validation 3D assets: {len(files)} files, {len(archives)} ZIP archives, "
364
+ f"{int(release_summary['bytes']) / (1024 ** 3):.2f} GiB download"
365
+ )
366
+ print(f"Project root: {output_dir / '3D Assets' / 'PhysicBenchmark'}")
367
+ if args.dry_run:
368
+ return 0
369
+
370
+ output_dir.mkdir(parents=True, exist_ok=True)
371
+ run_id = datetime.now().strftime("%Y%m%d_%H%M%S")
372
+ logs = Logs(output_dir / "_3d_asset_download_logs" / run_id)
373
+ results: list[DownloadResult] = []
374
+ with ThreadPoolExecutor(max_workers=args.workers) as pool:
375
+ futures = {
376
+ pool.submit(
377
+ download_one,
378
+ path,
379
+ output_dir,
380
+ cache_dir,
381
+ args.revision,
382
+ args.delete_zip_after_extract,
383
+ ): path
384
+ for path in files
385
+ }
386
+ completed = as_completed(futures)
387
+ if tqdm is not None:
388
+ completed = tqdm(completed, total=len(futures), unit="file", desc="Download")
389
+ for future in completed:
390
+ result = future.result()
391
+ logs.record_download(result)
392
+ results.append(result)
393
+
394
+ download_failures = [result for result in results if result.error]
395
+ extraction_failures = 0
396
+ extracted = 0
397
+ if not args.no_extract:
398
+ iterable = archives
399
+ if tqdm is not None:
400
+ iterable = tqdm(archives, unit="archive", desc="Extract")
401
+ for remote_path in iterable:
402
+ archive_path = output_dir.joinpath(*PurePosixPath(remote_path).parts)
403
+ if completed_removed_archive(archive_path):
404
+ logs.record_extraction(remote_path, "already_extracted_zip_removed", 0, 0)
405
+ extracted += 1
406
+ continue
407
+ if not archive_path.is_file():
408
+ error = "archive is unavailable because its download failed"
409
+ logs.record_extraction(remote_path, "failed", 0, 0, error)
410
+ extraction_failures += 1
411
+ continue
412
+ try:
413
+ status, added, reused = extract_archive(archive_path)
414
+ logs.record_extraction(remote_path, status, added, reused)
415
+ extracted += 1
416
+ if args.delete_zip_after_extract:
417
+ archive_path.unlink()
418
+ except Exception as exc:
419
+ logs.record_extraction(
420
+ remote_path, "failed", 0, 0, safe_message(exc)
421
+ )
422
+ extraction_failures += 1
423
+
424
+ summary = {
425
+ "repo_id": REPO_ID,
426
+ "revision": args.revision,
427
+ "release": "validation",
428
+ "expected_files": len(files),
429
+ "successful_downloads": len(results) - len(download_failures),
430
+ "download_failures": len(download_failures),
431
+ "expected_archives": len(archives),
432
+ "completed_archives": extracted,
433
+ "extraction_failures": extraction_failures,
434
+ "project_root": str(output_dir / "3D Assets" / "PhysicBenchmark"),
435
+ "log_dir": str(logs.root),
436
+ "finished_at": utc_now(),
437
+ }
438
+ (logs.root / "summary.json").write_text(
439
+ json.dumps(summary, indent=2, sort_keys=True) + "\n", encoding="utf-8"
440
+ )
441
+ print(json.dumps(summary, indent=2, sort_keys=True))
442
+ return 1 if download_failures or extraction_failures else 0
443
+
444
+
445
+ if __name__ == "__main__":
446
+ raise SystemExit(main())
README.md CHANGED
@@ -298,6 +298,7 @@ homepage: https://vlar-group.github.io/PhysInOne.html
298
  <a href="#release-timetable">πŸš€ Release Timetable</a><br>
299
  <a href="#dataset-repositories">πŸ“¦ Repositories & Downloads</a><br>
300
  <a href="#data-splits">πŸ“Š Data Splits</a><br>
 
301
  <a href="#leaderboard-evaluation-data">πŸ† Leaderboard Evaluation Data</a><br>
302
  <a href="#how-to-download">πŸ“₯ How to Download</a><br>
303
  &nbsp;&nbsp;&nbsp;<a href="#download-scripts">1. Download Scripts</a><br>
@@ -370,7 +371,7 @@ homepage: https://vlar-group.github.io/PhysInOne.html
370
  | Rendered Data - Train | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ` 100%(122988/122988) | Released | Last updated: Aug 21 |
371
  | Rendered Data - Test | `β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘` 0%(0/15411) | In progress | |
372
  | Rendered Data - Val | `β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘`Β 1%(103/15411) | In progress | |
373
- | 3D Assets | `β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘` 0% | Not released | Expected around Aug |
374
  | Leaderboard | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ` 100% | Released | Public evaluation data for four tasks |
375
  | Baseline code | `β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘` 25% | In progress | Last updated: Jul 23 |
376
  | Data processing | `β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘` 0% | Not released | Expected around Aug |
@@ -484,6 +485,41 @@ PhysInOne is divided into <strong>Train, Val, and Test</strong> splits, containi
484
  </div>
485
 
486
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
487
  <h2 id="leaderboard-evaluation-data" style="margin-left: 0; font-size: 1.9em; line-height: 1.22; margin-top: 1.2em; margin-bottom: 0.5em;">πŸ† Leaderboard Evaluation Data</h2>
488
  <div style="margin-left: 24px; text-align: justify;">
489
 
@@ -535,15 +571,21 @@ PhysInOne Utils/
535
  β”œβ”€β”€ metadata/
536
  β”‚ β”œβ”€β”€ repo_assignment.txt
537
  β”‚ └── repo_map.json
 
 
 
 
538
  β”œβ”€β”€ leaderboard_lists/
539
  β”‚ β”œβ”€β”€ video-generation.txt
540
  β”‚ β”œβ”€β”€ future-prediction.txt
541
  β”‚ β”œβ”€β”€ physical-properties-estimation.txt
542
  β”‚ └── motion-transfer.txt
 
543
  β”œβ”€β”€ LEADERBOARD_DOWNLOAD.md
544
  └── scripts/
545
  β”œβ”€β”€ filter_cases.py
546
  β”œβ”€β”€ download.py
 
547
  └── download_leaderboard.py
548
  ```
549
 
@@ -558,6 +600,7 @@ PhysInOne is distributed across multiple Hugging Face dataset repositories becau
558
  - `filter_cases.py`: exports selected cases to JSON.
559
  - `download.py`: downloads the selected case zip files from the corresponding repositories.
560
  - `download_leaderboard.py`: downloads public evaluation data for the four Leaderboard tasks; see `LEADERBOARD_DOWNLOAD.md`.
 
561
 
562
  </div>
563
 
 
298
  <a href="#release-timetable">πŸš€ Release Timetable</a><br>
299
  <a href="#dataset-repositories">πŸ“¦ Repositories & Downloads</a><br>
300
  <a href="#data-splits">πŸ“Š Data Splits</a><br>
301
+ <a href="#three-d-assets">🧱 Validation 3D Assets</a><br>
302
  <a href="#leaderboard-evaluation-data">πŸ† Leaderboard Evaluation Data</a><br>
303
  <a href="#how-to-download">πŸ“₯ How to Download</a><br>
304
  &nbsp;&nbsp;&nbsp;<a href="#download-scripts">1. Download Scripts</a><br>
 
371
  | Rendered Data - Train | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ` 100%(122988/122988) | Released | Last updated: Aug 21 |
372
  | Rendered Data - Test | `β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘` 0%(0/15411) | In progress | |
373
  | Rendered Data - Val | `β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘`Β 1%(103/15411) | In progress | |
374
+ | 3D Assets | `β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘` 20% | Partially released | Validation assets for 1,000 scenes |
375
  | Leaderboard | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ` 100% | Released | Public evaluation data for four tasks |
376
  | Baseline code | `β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘` 25% | In progress | Last updated: Jul 23 |
377
  | Data processing | `β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘` 0% | Not released | Expected around Aug |
 
485
  </div>
486
 
487
 
488
+
489
+ <h2 id="three-d-assets" style="margin-left: 0; font-size: 1.9em; line-height: 1.22; margin-top: 1.2em; margin-bottom: 0.5em;">🧱 Validation 3D Assets</h2>
490
+ <div style="margin-left: 24px; text-align: justify;">
491
+
492
+ The first public 3D asset release is now available and contains Unreal Engine project resources for <strong>1,000 validation scenes</strong>. The current release includes 4,299 files (approximately 22.25 GiB), including eight archives that must be extracted in place while preserving their project-relative paths. Full training asset archives are not part of this validation release.
493
+
494
+ - [Browse the `PhysicBenchmark` project](https://huggingface.co/datasets/vLAR/PhysInOne/tree/main/3D%20Assets/PhysicBenchmark)
495
+ - [Download and setup guide](https://huggingface.co/datasets/vLAR/PhysInOne/blob/main/PhysInOne%20Utils/3D_ASSETS_DOWNLOAD.md)
496
+ - [Automated downloader](https://huggingface.co/datasets/vLAR/PhysInOne/blob/main/PhysInOne%20Utils/scripts/download_3d_assets.py)
497
+ - [Exact validation release list](https://huggingface.co/datasets/vLAR/PhysInOne/blob/main/PhysInOne%20Utils/3d_assets_lists/validation.txt)
498
+
499
+ Install <strong>Unreal Engine 5.5.4</strong>. Windows is recommended for the simplest setup; Linux is also supported with additional platform configuration. The automated downloader retrieves the exact release, safely extracts all eight ZIP files into their correct parent directories, preserves the Unreal Engine package hierarchy, supports interrupted-run recovery, and records detailed logs.
500
+
501
+ ```bash
502
+ pip install -U huggingface_hub tqdm
503
+
504
+ hf download vLAR/PhysInOne \
505
+ "PhysInOne Utils/scripts/download_3d_assets.py" \
506
+ --repo-type dataset \
507
+ --local-dir .
508
+
509
+ python "PhysInOne Utils/scripts/download_3d_assets.py" \
510
+ --output-dir ./PhysInOne-3D-Assets
511
+ ```
512
+
513
+ After download and extraction, open:
514
+
515
+ ```text
516
+ PhysInOne-3D-Assets/3D Assets/PhysicBenchmark/PhysInOne.uproject
517
+ ```
518
+
519
+ Do not rename or flatten directories such as `Content/PhysInOne/`, `Content/__ExternalActors__/`, or `Content/__ExternalObjects__/`; Unreal Engine asset references depend on the exact project-relative structure. See the full setup guide for manual extraction paths, disk-space guidance, resume behavior, and troubleshooting.
520
+
521
+ </div>
522
+
523
  <h2 id="leaderboard-evaluation-data" style="margin-left: 0; font-size: 1.9em; line-height: 1.22; margin-top: 1.2em; margin-bottom: 0.5em;">πŸ† Leaderboard Evaluation Data</h2>
524
  <div style="margin-left: 24px; text-align: justify;">
525
 
 
571
  β”œβ”€β”€ metadata/
572
  β”‚ β”œβ”€β”€ repo_assignment.txt
573
  β”‚ └── repo_map.json
574
+ β”œβ”€β”€ 3d_assets_lists/
575
+ β”‚ β”œβ”€β”€ validation.txt
576
+ β”‚ β”œβ”€β”€ validation_archives.txt
577
+ β”‚ └── summary.json
578
  β”œβ”€β”€ leaderboard_lists/
579
  β”‚ β”œβ”€β”€ video-generation.txt
580
  β”‚ β”œβ”€β”€ future-prediction.txt
581
  β”‚ β”œβ”€β”€ physical-properties-estimation.txt
582
  β”‚ └── motion-transfer.txt
583
+ β”œβ”€β”€ 3D_ASSETS_DOWNLOAD.md
584
  β”œβ”€β”€ LEADERBOARD_DOWNLOAD.md
585
  └── scripts/
586
  β”œβ”€β”€ filter_cases.py
587
  β”œβ”€β”€ download.py
588
+ β”œβ”€β”€ download_3d_assets.py
589
  └── download_leaderboard.py
590
  ```
591
 
 
600
  - `filter_cases.py`: exports selected cases to JSON.
601
  - `download.py`: downloads the selected case zip files from the corresponding repositories.
602
  - `download_leaderboard.py`: downloads public evaluation data for the four Leaderboard tasks; see `LEADERBOARD_DOWNLOAD.md`.
603
+ - `download_3d_assets.py`: downloads and safely assembles the validation Unreal Engine project; see `3D_ASSETS_DOWNLOAD.md`.
604
 
605
  </div>
606