-
Notifications
You must be signed in to change notification settings - Fork 9
Add configurable data roots and asset download CLI #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
|
|
||
| # Data Assets | ||
|
|
||
| EmbodiChain provides a comprehensive set of pre-built data assets hosted on HuggingFace, covering robots, end-effectors, objects, scenes, materials, and more. Assets are automatically downloaded on first use, but you can also pre-download them using the built-in CLI tool. | ||
|
|
||
| ## Data Root Directory | ||
|
|
||
| By default, assets are stored in `~/.cache/embodichain_data`. You can override this by setting the `EMBODICHAIN_DATA_ROOT` environment variable: | ||
|
|
||
| ```bash | ||
| export EMBODICHAIN_DATA_ROOT=/mnt/shared/embodichain_data | ||
| ``` | ||
|
|
||
| Similarly, the dataset recording root (used by `LeRobotRecorder`) defaults to `~/.cache/embodichain_datasets` and can be overridden with: | ||
|
|
||
| ```bash | ||
| export EMBODICHAIN_DATASET_ROOT=/mnt/shared/embodichain_datasets | ||
| ``` | ||
|
|
||
| ## Download CLI | ||
|
|
||
| The `embodichain.data` module provides a command-line interface for managing assets. | ||
|
|
||
| ### List Available Assets | ||
|
|
||
| ```bash | ||
| # List all assets across every category | ||
| python -m embodichain.data list | ||
|
|
||
| # List assets in a specific category | ||
| python -m embodichain.data list --category robot | ||
| ``` | ||
|
|
||
| The output shows each asset name and whether it has already been downloaded (`✓`): | ||
|
|
||
| ```text | ||
| [robot] (18 assets) | ||
| [✓] ABB | ||
| [ ] ARX5 | ||
| [ ] Agile | ||
| [✓] Aubo | ||
| ... | ||
|
|
||
| Data root: /home/user/.cache/embodichain_data | ||
| ``` | ||
|
|
||
| ### Download Assets | ||
|
|
||
| ```bash | ||
| # Download a single asset by name | ||
| python -m embodichain.data download --name CobotMagicArm | ||
|
|
||
| # Download all assets in a category | ||
| python -m embodichain.data download --category robot | ||
|
|
||
| # Download everything | ||
| python -m embodichain.data download --all | ||
| ``` | ||
|
|
||
| Downloaded files are saved to `<data_root>/download/` and automatically extracted to `<data_root>/extract/`. Non-zip assets (e.g. `.glb` files) are copied into the extract directory. | ||
|
|
||
| ## Asset Categories | ||
|
|
||
| | Category | Description | Examples | | ||
| |-------------|------------------------------------------------|-------------------------------------------------| | ||
| | `robot` | Robot URDF models | CobotMagicArm, Franka, UniversalRobots, UnitreeH1 | | ||
| | `eef` | End-effector / gripper models | DH_PGC_140_50, Robotiq2F85, InspireHand | | ||
| | `obj` | Manipulable objects and furniture | ShopTableSimple, CoffeeCup, TableWare | | ||
| | `scene` | Full scene environments | SceneData, EmptyRoom | | ||
| | `materials` | Rendering materials, IBL, and backgrounds | SimResources, CocoBackground | | ||
| | `w1` | DexForce W1 humanoid robot and components | DexforceW1V021, DexforceW1ChassisV021 | | ||
| | `demo` | Demo scene data | ScoopIceNewEnv, MultiW1Data | | ||
|
|
||
| ## Using Assets in Code | ||
|
|
||
| Use `get_data_path` to resolve asset paths in your configuration. It accepts a relative path in the format `<AssetClassName>/<subpath>`: | ||
|
|
||
| ```python | ||
| from embodichain.data import get_data_path | ||
|
|
||
| # Resolves to the URDF file, downloading if necessary | ||
| urdf_path = get_data_path("CobotMagicArm/CobotMagicWithGripperV100.urdf") | ||
| ``` | ||
|
|
||
| `get_data_path` resolves paths in the following order: | ||
|
|
||
| 1. **Absolute path** — returned as-is. | ||
| 2. **Local data root** — if the file exists under `EMBODICHAIN_DATA_ROOT`, it is returned immediately without triggering a download. | ||
| 3. **Data-class download** — falls back to the registered asset class, which downloads and extracts the asset from HuggingFace. | ||
|
|
||
| You can also instantiate asset classes directly: | ||
|
|
||
| ```python | ||
| from embodichain.data.assets import CobotMagicArm | ||
|
|
||
| dataset = CobotMagicArm() | ||
| print(dataset.extract_dir) # Path to extracted files | ||
| ``` | ||
|
|
||
| ## Adding Custom Assets | ||
|
|
||
| To add a new asset: | ||
|
|
||
| 1. **Create a class** in the appropriate file under `embodichain/data/assets/` (e.g., `robot_assets.py` for a robot): | ||
|
|
||
| ```python | ||
| class MyRobot(EmbodiChainDataset): | ||
| def __init__(self, data_root: str = None): | ||
| data_descriptor = o3d.data.DataDescriptor( | ||
| os.path.join(EMBODICHAIN_DOWNLOAD_PREFIX, robot_assets, "MyRobot.zip"), | ||
| "<md5_checksum>", | ||
| ) | ||
| prefix = type(self).__name__ | ||
| path = EMBODICHAIN_DEFAULT_DATA_ROOT if data_root is None else data_root | ||
| super().__init__(prefix, data_descriptor, path) | ||
| ``` | ||
|
|
||
| 2. The class is automatically discovered by the download CLI and `get_data_path` — no additional registration is needed. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # ---------------------------------------------------------------------------- | ||
| # Copyright (c) 2021-2026 DexForce Technology Co., Ltd. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # ---------------------------------------------------------------------------- | ||
|
|
||
| """Allow ``python -m embodichain.data`` to invoke the download CLI.""" | ||
|
|
||
| from embodichain.data.download import main | ||
|
|
||
| main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The markdown table under "Asset Categories" is written with double pipes (
|| ...) which will render as an extra empty column in most markdown renderers. Use single-pipe table syntax (| Category | Description | Examples |etc.) so the table renders correctly in the docs site.