Spaces:
Running
Running
Take it home: align download commands with what the new datasets actually ship. Isaac/usdview grab <vid>.usda + textures/; MuJoCo grabs mjcf/** (xml + visuals/ + collision/); Blender grabs .glb (no .blend files). Uses huggingface_hub snapshot_download in place of per-file curl.
Browse files- index.html +65 -40
index.html
CHANGED
|
@@ -357,94 +357,119 @@ const ENVS = [
|
|
| 357 |
{ id: "auto", label: "Auto-detect", fmt: "detects engine",
|
| 358 |
os: ["mac", "win", "linux"],
|
| 359 |
prereq: "Runs whichever engine you have installed (detected at run time)." },
|
| 360 |
-
{ id: "isaac", label: "Isaac Sim", fmt: "USD",
|
| 361 |
os: ["win", "linux"],
|
| 362 |
prereq: "Isaac Sim β Linux/Windows + an NVIDIA RTX GPU." },
|
| 363 |
-
{ id: "mujoco", label: "MuJoCo", fmt: "MJCF",
|
| 364 |
os: ["mac", "win", "linux"],
|
| 365 |
prereq: "pip install mujoco Β· any OS." },
|
| 366 |
-
{ id: "usd", label: "usdview / Omniverse", fmt: "USD",
|
| 367 |
os: ["mac", "win", "linux"],
|
| 368 |
prereq: "usdview (pip install usd-core) β Omniverse needs Linux/Win + RTX." },
|
| 369 |
-
{ id: "blender", label: "Blender", fmt: ".
|
| 370 |
os: ["mac", "win", "linux"],
|
| 371 |
-
prereq: "Blender β free at blender.org/download." },
|
| 372 |
];
|
| 373 |
const envById = id => ENVS.find(e => e.id === id);
|
| 374 |
const naOn = e => e.id !== "auto" && !e.os.includes(OS);
|
| 375 |
if (!envById(curEnv)) curEnv = "auto"; // default: self-detect
|
| 376 |
|
| 377 |
-
const resUrl = (cls, item, file) =>
|
| 378 |
-
`${HFDS}/${cls.dataset}/resolve/main/${cls.items_dir}/${item.id}/${file}`;
|
| 379 |
const classLabel = cls =>
|
| 380 |
cls.dataset.replace(/^articulated-/, "")
|
| 381 |
.replace(/ies$/, "y").replace(/([sxz]|ch|sh)es$/, "$1").replace(/s$/, "");
|
| 382 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 383 |
// the open step, aware of OS (macOS needs mjpython; Blender launcher differs)
|
| 384 |
-
function openCmd(env,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 385 |
if (env === "mujoco")
|
| 386 |
return OS === "mac"
|
| 387 |
-
? `mjpython -m mujoco.viewer --mjcf=${
|
| 388 |
-
: `python -m mujoco.viewer --mjcf=${
|
| 389 |
if (env === "blender")
|
| 390 |
-
return OS === "mac" ? `open -a Blender ${
|
| 391 |
if (env === "usd")
|
| 392 |
-
return `usdview ${
|
| 393 |
return `"$ISAAC_SIM/python.sh" - <<PY\n` + // isaac
|
| 394 |
`from isaacsim import SimulationApp\n` +
|
| 395 |
-
`app = SimulationApp({"open_usd": "$PWD/${
|
| 396 |
`while app.is_running():\n app.update()\nPY`;
|
| 397 |
}
|
| 398 |
|
| 399 |
function cmdFor(env, cls, item) {
|
| 400 |
-
const id = item.id;
|
| 401 |
if (env === "auto") return autoScript(cls, item);
|
| 402 |
-
const head = `mkdir -p projectsim-assets && cd projectsim-assets\n\n`;
|
| 403 |
-
const grab = (file) =>
|
| 404 |
-
`curl --fail --location --progress-bar \\\n` +
|
| 405 |
-
` "${resUrl(cls, item, file)}?download=true" \\\n` +
|
| 406 |
-
` --output ${file}\n`;
|
| 407 |
const naNote = naOn(envById(env))
|
| 408 |
? `# ${envById(env).label} doesn't run on ${OS_LABEL} β run this on a\n` +
|
| 409 |
`# Linux/Windows box with an NVIDIA RTX GPU (or a cloud instance).\n\n`
|
| 410 |
: "";
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
const
|
| 418 |
? `\n# open the play-ready scene in Isaac Sim, then press Play\n` +
|
| 419 |
-
`# (set ISAAC_SIM to your install, e.g. ~/isaacsim)\n
|
| 420 |
-
:
|
| 421 |
-
|
|
|
|
|
|
|
| 422 |
}
|
| 423 |
|
| 424 |
// The browser can't read your disk β so this script does the detection itself,
|
| 425 |
// at run time, and launches whichever engine you actually have installed.
|
| 426 |
function autoScript(cls, item) {
|
| 427 |
const id = item.id;
|
| 428 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 429 |
return `# Paste in a macOS/Linux terminal β finds your installed engine.\n` +
|
| 430 |
`mkdir -p projectsim-assets && cd projectsim-assets\n` +
|
| 431 |
-
`
|
| 432 |
`if [ -n "$ISAAC_SIM" ] && [ -x "$ISAAC_SIM/python.sh" ]; then\n` +
|
| 433 |
-
` echo "β Isaac Sim"
|
|
|
|
| 434 |
` "$ISAAC_SIM/python.sh" - <<PY\n` +
|
| 435 |
`from isaacsim import SimulationApp\n` +
|
| 436 |
-
`app = SimulationApp({"open_usd": "$PWD/${
|
| 437 |
`while app.is_running(): app.update()\nPY\n` +
|
| 438 |
`elif command -v mjpython >/dev/null 2>&1 || python -c "import mujoco" 2>/dev/null; then\n` +
|
| 439 |
-
` echo "β MuJoCo"
|
| 440 |
-
`
|
| 441 |
-
`
|
|
|
|
| 442 |
`elif command -v usdview >/dev/null 2>&1; then\n` +
|
| 443 |
-
` echo "β usdview"
|
| 444 |
-
`
|
|
|
|
| 445 |
`elif command -v blender >/dev/null 2>&1 || [ -d /Applications/Blender.app ]; then\n` +
|
| 446 |
-
` echo "β Blender"
|
| 447 |
-
`
|
|
|
|
| 448 |
`else\n` +
|
| 449 |
` echo "No engine found β easiest is: pip install mujoco (then re-run)."\n` +
|
| 450 |
`fi`;
|
|
|
|
| 357 |
{ id: "auto", label: "Auto-detect", fmt: "detects engine",
|
| 358 |
os: ["mac", "win", "linux"],
|
| 359 |
prereq: "Runs whichever engine you have installed (detected at run time)." },
|
| 360 |
+
{ id: "isaac", label: "Isaac Sim", fmt: "USD + textures",
|
| 361 |
os: ["win", "linux"],
|
| 362 |
prereq: "Isaac Sim β Linux/Windows + an NVIDIA RTX GPU." },
|
| 363 |
+
{ id: "mujoco", label: "MuJoCo", fmt: "MJCF + meshes",
|
| 364 |
os: ["mac", "win", "linux"],
|
| 365 |
prereq: "pip install mujoco Β· any OS." },
|
| 366 |
+
{ id: "usd", label: "usdview / Omniverse", fmt: "USD + textures",
|
| 367 |
os: ["mac", "win", "linux"],
|
| 368 |
prereq: "usdview (pip install usd-core) β Omniverse needs Linux/Win + RTX." },
|
| 369 |
+
{ id: "blender", label: "Blender", fmt: ".glb",
|
| 370 |
os: ["mac", "win", "linux"],
|
| 371 |
+
prereq: "Blender 4.0+ β free at blender.org/download." },
|
| 372 |
];
|
| 373 |
const envById = id => ENVS.find(e => e.id === id);
|
| 374 |
const naOn = e => e.id !== "auto" && !e.os.includes(OS);
|
| 375 |
if (!envById(curEnv)) curEnv = "auto"; // default: self-detect
|
| 376 |
|
|
|
|
|
|
|
| 377 |
const classLabel = cls =>
|
| 378 |
cls.dataset.replace(/^articulated-/, "")
|
| 379 |
.replace(/ies$/, "y").replace(/([sxz]|ch|sh)es$/, "$1").replace(/s$/, "");
|
| 380 |
|
| 381 |
+
// One-shot snapshot download of a subtree from the dataset via huggingface_hub.
|
| 382 |
+
// Files land at the same relative path they have on the hub.
|
| 383 |
+
function hfDl(cls, item, patterns) {
|
| 384 |
+
const inc = patterns.map(p => `"assets/${cls.class}/${item.id}/${p}"`).join(", ");
|
| 385 |
+
return `python - <<'PY'\n` +
|
| 386 |
+
`from huggingface_hub import snapshot_download\n` +
|
| 387 |
+
`snapshot_download("projectsim/${cls.dataset}", repo_type="dataset",\n` +
|
| 388 |
+
` allow_patterns=[${inc}], local_dir=".")\n` +
|
| 389 |
+
`PY\n`;
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
// The path a downloaded file lives at, relative to projectsim-assets/.
|
| 393 |
+
const assetPath = (cls, item, file) => `assets/${cls.class}/${item.id}/${file}`;
|
| 394 |
+
|
| 395 |
// the open step, aware of OS (macOS needs mjpython; Blender launcher differs)
|
| 396 |
+
function openCmd(env, cls, item) {
|
| 397 |
+
const id = item.id;
|
| 398 |
+
const usda = assetPath(cls, item, `${id}.usda`);
|
| 399 |
+
const xml = assetPath(cls, item, `mjcf/${id}.xml`);
|
| 400 |
+
const glb = assetPath(cls, item, `${id}.glb`);
|
| 401 |
if (env === "mujoco")
|
| 402 |
return OS === "mac"
|
| 403 |
+
? `mjpython -m mujoco.viewer --mjcf=${xml}`
|
| 404 |
+
: `python -m mujoco.viewer --mjcf=${xml}`;
|
| 405 |
if (env === "blender")
|
| 406 |
+
return OS === "mac" ? `open -a Blender ${glb}` : `blender ${glb}`;
|
| 407 |
if (env === "usd")
|
| 408 |
+
return `usdview ${usda}`;
|
| 409 |
return `"$ISAAC_SIM/python.sh" - <<PY\n` + // isaac
|
| 410 |
`from isaacsim import SimulationApp\n` +
|
| 411 |
+
`app = SimulationApp({"open_usd": "$PWD/${usda}"})\n` +
|
| 412 |
`while app.is_running():\n app.update()\nPY`;
|
| 413 |
}
|
| 414 |
|
| 415 |
function cmdFor(env, cls, item) {
|
|
|
|
| 416 |
if (env === "auto") return autoScript(cls, item);
|
| 417 |
+
const head = `mkdir -p projectsim-assets && cd projectsim-assets\npip install -q huggingface_hub\n\n`;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 418 |
const naNote = naOn(envById(env))
|
| 419 |
? `# ${envById(env).label} doesn't run on ${OS_LABEL} β run this on a\n` +
|
| 420 |
`# Linux/Windows box with an NVIDIA RTX GPU (or a cloud instance).\n\n`
|
| 421 |
: "";
|
| 422 |
+
const patterns = {
|
| 423 |
+
isaac: [`${item.id}.usda`, "textures/**"],
|
| 424 |
+
usd: [`${item.id}.usda`, "textures/**"],
|
| 425 |
+
mujoco: ["mjcf/**"],
|
| 426 |
+
blender: [`${item.id}.glb`],
|
| 427 |
+
}[env];
|
| 428 |
+
const preOpen = env === "isaac"
|
| 429 |
? `\n# open the play-ready scene in Isaac Sim, then press Play\n` +
|
| 430 |
+
`# (set ISAAC_SIM to your install, e.g. ~/isaacsim)\n`
|
| 431 |
+
: env === "mujoco"
|
| 432 |
+
? `\n# self-contained model (visuals + colliders + joints + latches)\n`
|
| 433 |
+
: "\n";
|
| 434 |
+
return naNote + head + hfDl(cls, item, patterns) + preOpen + openCmd(env, cls, item);
|
| 435 |
}
|
| 436 |
|
| 437 |
// The browser can't read your disk β so this script does the detection itself,
|
| 438 |
// at run time, and launches whichever engine you actually have installed.
|
| 439 |
function autoScript(cls, item) {
|
| 440 |
const id = item.id;
|
| 441 |
+
const usda = assetPath(cls, item, `${id}.usda`);
|
| 442 |
+
const xml = assetPath(cls, item, `mjcf/${id}.xml`);
|
| 443 |
+
const glb = assetPath(cls, item, `${id}.glb`);
|
| 444 |
+
const dl = (patterns) =>
|
| 445 |
+
`python - <<PY\n` +
|
| 446 |
+
`from huggingface_hub import snapshot_download\n` +
|
| 447 |
+
`snapshot_download("projectsim/${cls.dataset}", repo_type="dataset",\n` +
|
| 448 |
+
` allow_patterns=[${patterns.map(p=>`"assets/${cls.class}/${id}/${p}"`).join(", ")}], local_dir=".")\n` +
|
| 449 |
+
`PY`;
|
| 450 |
return `# Paste in a macOS/Linux terminal β finds your installed engine.\n` +
|
| 451 |
`mkdir -p projectsim-assets && cd projectsim-assets\n` +
|
| 452 |
+
`pip install -q huggingface_hub\n\n` +
|
| 453 |
`if [ -n "$ISAAC_SIM" ] && [ -x "$ISAAC_SIM/python.sh" ]; then\n` +
|
| 454 |
+
` echo "β Isaac Sim"\n` +
|
| 455 |
+
` ${dl([`${id}.usda`, "textures/**"])}\n` +
|
| 456 |
` "$ISAAC_SIM/python.sh" - <<PY\n` +
|
| 457 |
`from isaacsim import SimulationApp\n` +
|
| 458 |
+
`app = SimulationApp({"open_usd": "$PWD/${usda}"})\n` +
|
| 459 |
`while app.is_running(): app.update()\nPY\n` +
|
| 460 |
`elif command -v mjpython >/dev/null 2>&1 || python -c "import mujoco" 2>/dev/null; then\n` +
|
| 461 |
+
` echo "β MuJoCo"\n` +
|
| 462 |
+
` ${dl(["mjcf/**"])}\n` +
|
| 463 |
+
` { command -v mjpython >/dev/null 2>&1 && mjpython -m mujoco.viewer --mjcf=${xml}; } \\\n` +
|
| 464 |
+
` || python -m mujoco.viewer --mjcf=${xml}\n` +
|
| 465 |
`elif command -v usdview >/dev/null 2>&1; then\n` +
|
| 466 |
+
` echo "β usdview"\n` +
|
| 467 |
+
` ${dl([`${id}.usda`, "textures/**"])}\n` +
|
| 468 |
+
` usdview ${usda}\n` +
|
| 469 |
`elif command -v blender >/dev/null 2>&1 || [ -d /Applications/Blender.app ]; then\n` +
|
| 470 |
+
` echo "β Blender"\n` +
|
| 471 |
+
` ${dl([`${id}.glb`])}\n` +
|
| 472 |
+
` { command -v blender >/dev/null 2>&1 && blender ${glb}; } || open -a Blender ${glb}\n` +
|
| 473 |
`else\n` +
|
| 474 |
` echo "No engine found β easiest is: pip install mujoco (then re-run)."\n` +
|
| 475 |
`fi`;
|