-
Notifications
You must be signed in to change notification settings - Fork 5
Include cosmos transfer1 dependency #134
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
10 commits
Select commit
Hold shift + click to select a range
04f9973
add cosmos dep
KumoLiu 262ef09
update using bash utils
KumoLiu 5755bb1
seperate policy to individual bash
KumoLiu 3a460ab
update surgery part
KumoLiu 19a84b4
minor fix
KumoLiu c5be8c5
add cosmos pi0 and groot install bash
KumoLiu a2e5bd8
minor update
KumoLiu d68cad5
minor fix
KumoLiu f362284
address comments and temp remove cosmos in the us
KumoLiu 534726b
temp remove cosmos
KumoLiu 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| #!/bin/bash | ||
|
|
||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # 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. | ||
|
|
||
| # --- Utility Functions --- | ||
|
|
||
| check_conda_env() { | ||
| if [ -z "$CONDA_DEFAULT_ENV" ]; then | ||
| echo "Error: No active conda environment detected" | ||
| echo "Please activate a conda environment before running this script" | ||
| exit 1 | ||
| fi | ||
| echo "Using conda environment: $CONDA_DEFAULT_ENV" | ||
| } | ||
|
|
||
| check_nvidia_gpu() { | ||
| if ! nvidia-smi &> /dev/null; then | ||
| echo "Error: NVIDIA GPU not found or driver not installed" | ||
| exit 1 | ||
| fi | ||
| echo "NVIDIA GPU detected." | ||
| } | ||
|
|
||
| check_project_root() { | ||
| if [ -z "$PROJECT_ROOT" ]; then | ||
| echo "Error: PROJECT_ROOT is not set. This script should be sourced by a parent script that defines PROJECT_ROOT." | ||
| exit 1 | ||
| fi | ||
| echo "PROJECT_ROOT is set to: $PROJECT_ROOT" | ||
| } | ||
|
|
||
| ensure_fresh_third_party_dir() { | ||
| check_project_root # Ensure PROJECT_ROOT is available | ||
| THIRDPARTY_DIR="$PROJECT_ROOT/third_party" | ||
|
|
||
| if [ -d "$THIRDPARTY_DIR" ]; then | ||
| echo "Error: third_party directory already exists at $THIRDPARTY_DIR" | ||
| echo "Please remove the third_party directory before running this script with policies that require a fresh setup (e.g., pi0, gr00tn1)." | ||
| exit 1 | ||
| else | ||
| mkdir "$THIRDPARTY_DIR" | ||
| echo "Created directory: $THIRDPARTY_DIR" | ||
| fi | ||
| } |
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,53 @@ | ||
| #!/bin/bash | ||
|
|
||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # 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. | ||
|
|
||
| set -e | ||
|
|
||
| # Get the parent directory of the current script | ||
| # Assuming this script is in tools/env_setup/ | ||
| PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd ../.. && pwd)" | ||
|
|
||
| # Source utility functions | ||
| source "$PROJECT_ROOT/tools/env_setup/bash_utils.sh" | ||
|
|
||
| check_project_root | ||
| check_conda_env | ||
|
|
||
| conda install -c conda-forge ninja libgl ffmpeg gcc=12.4.0 gxx=12.4.0 -y | ||
|
|
||
| COSMOS_TRANSFER_DIR="$PROJECT_ROOT/third_party/cosmos-transfer1" | ||
|
|
||
| if [ -d "$COSMOS_TRANSFER_DIR" ]; then | ||
| echo "Cosmos Transfer directory already exists at $COSMOS_TRANSFER_DIR. Skipping clone." | ||
| else | ||
| echo "Cloning Cosmos Transfer repository into $COSMOS_TRANSFER_DIR..." | ||
| git clone [email protected]:nvidia-cosmos/cosmos-transfer1.git "$COSMOS_TRANSFER_DIR" | ||
| fi | ||
|
|
||
| pushd "$COSMOS_TRANSFER_DIR" | ||
| git checkout bf54a70a8c44d615620728c493ee26b4376ccfd6 | ||
| git submodule update --init --recursive | ||
| pip install -r requirements.txt | ||
| # Patch Transformer engine linking issues in conda environments. | ||
| ln -sf $CONDA_PREFIX/lib/python3.10/site-packages/nvidia/*/include/* $CONDA_PREFIX/include/ | ||
| ln -sf $CONDA_PREFIX/lib/python3.10/site-packages/nvidia/*/include/* $CONDA_PREFIX/include/python3.10 | ||
| pip install transformer-engine[pytorch]==1.12.0 | ||
|
|
||
| CUDA_HOME=$CONDA_PREFIX PYTHONPATH=$(pwd) python scripts/test_environment.py | ||
| popd | ||
|
|
||
| echo "Cosmos Transfer Dependencies Installation Finished" |
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,57 @@ | ||
| #!/bin/bash | ||
|
|
||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # 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. | ||
|
|
||
| set -e | ||
|
|
||
| # Get the parent directory of the current script | ||
| # Assuming this script is in tools/env_setup/ | ||
| PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd ../.. && pwd)" | ||
|
|
||
| # Assuming bash_utils.sh is in $PROJECT_ROOT/tools/env_setup/bash_utils.sh | ||
| source "$PROJECT_ROOT/tools/env_setup/bash_utils.sh" | ||
|
|
||
| check_project_root | ||
|
|
||
| echo "--- Installing GR00T N1 Policy Dependencies ---" | ||
|
|
||
| GR00T_DIR="$PROJECT_ROOT/third_party/Isaac-GR00T" | ||
|
|
||
| if [ -d "$GR00T_DIR" ]; then | ||
| echo "Isaac-GR00T directory already exists at $GR00T_DIR. Using existing clone." | ||
| else | ||
| echo "Cloning Isaac-GR00T repository into $GR00T_DIR..." | ||
| # Ensure parent third_party dir exists | ||
| mkdir -p "$PROJECT_ROOT/third_party" | ||
| git clone https://github.com/NVIDIA/Isaac-GR00T "$GR00T_DIR" | ||
| fi | ||
|
|
||
| pushd "$GR00T_DIR" | ||
|
|
||
| # Update pyav dependency in pyproject.toml if not already done | ||
| if grep -q "pyav" pyproject.toml; then | ||
| echo "Updating pyav to av in Isaac-GR00T's pyproject.toml..." | ||
| sed -i 's/pyav/av/' pyproject.toml | ||
| else | ||
| echo "pyav already updated to av or not found in Isaac-GR00T's pyproject.toml." | ||
| fi | ||
|
|
||
| pip install -e . | ||
| popd | ||
|
|
||
| pip install --no-build-isolation flash-attn==2.7.1.post4 | ||
|
|
||
| echo "GR00T N1 Policy Dependencies installed." |
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,47 @@ | ||
| #!/bin/bash | ||
|
|
||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # 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. | ||
|
|
||
| set -e | ||
|
|
||
| # Get the parent directory of the current script | ||
| # Assuming this script is in tools/env_setup/ | ||
| PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd ../.. && pwd)" | ||
|
|
||
| # Assuming bash_utils.sh is in $PROJECT_ROOT/tools/env_setup/bash_utils.sh | ||
| source "$PROJECT_ROOT/tools/env_setup/bash_utils.sh" | ||
|
|
||
| check_project_root | ||
| check_conda_env | ||
|
|
||
| conda install -c conda-forge gcc=13.3.0 -y | ||
| pip install holoscan==2.9.0 | ||
|
|
||
| HOLOSCAN_DIR=$PROJECT_ROOT/workflows/robotic_ultrasound/scripts/holoscan_apps/ | ||
|
|
||
| echo "Building Holoscan Apps..." | ||
| pushd $HOLOSCAN_DIR | ||
|
|
||
| # clean previous downloads and builds | ||
| rm -rf build | ||
| rm -rf clarius_solum/include | ||
| rm -rf clarius_solum/lib | ||
| rm -rf clarius_cast/include | ||
| rm -rf clarius_cast/lib | ||
| cmake -B build -S . && cmake --build build | ||
|
|
||
| popd | ||
| echo "Holoscan Apps build completed!" | ||
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 |
|---|---|---|
|
|
@@ -20,41 +20,34 @@ set -e | |
| # Get the parent directory of the current script | ||
| PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd ../.. && pwd)" | ||
|
|
||
| # Source utility functions | ||
| source "$PROJECT_ROOT/tools/env_setup/bash_utils.sh" | ||
|
|
||
| # Check if running in a conda environment | ||
| if [ -z "$CONDA_DEFAULT_ENV" ]; then | ||
| echo "Error: No active conda environment detected" | ||
| echo "Please activate a conda environment before running this script" | ||
| exit 1 | ||
| fi | ||
| echo "Using conda environment: $CONDA_DEFAULT_ENV" | ||
| check_conda_env | ||
|
|
||
| # Check if NVIDIA GPU is available | ||
| if ! nvidia-smi &> /dev/null; then | ||
| echo "Error: NVIDIA GPU not found or driver not installed" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Check if the third_party directory exists, if yes, then exit | ||
| if [ -d "$PROJECT_ROOT/third_party" ]; then | ||
| echo "Error: third_party directory already exists" | ||
| echo "Please remove the third_party directory before running this script" | ||
| exit 1 | ||
| fi | ||
| check_nvidia_gpu | ||
|
|
||
| # ---- Clone IsaacLab ---- | ||
| echo "Cloning IsaacLab..." | ||
| # CLONING REPOSITORIES INTO PROJECT_ROOT/third_party | ||
| echo "Cloning repositories into $PROJECT_ROOT/third_party..." | ||
| mkdir $PROJECT_ROOT/third_party | ||
| git clone -b v2.0.2 [email protected]:isaac-sim/IsaacLab.git $PROJECT_ROOT/third_party/IsaacLab | ||
| pushd $PROJECT_ROOT/third_party/IsaacLab | ||
| # Ensure the parent third_party directory exists | ||
| mkdir -p "$PROJECT_ROOT/third_party" | ||
|
|
||
| # ---- Install IsaacSim and necessary dependencies ---- | ||
| # ---- Install IsaacSim ---- | ||
| echo "Installing IsaacSim..." | ||
| pip install 'isaacsim[all,extscache]==4.5.0' \ | ||
| git+ssh://[email protected]/isaac-for-healthcare/[email protected] \ | ||
| --extra-index-url https://pypi.nvidia.com | ||
|
|
||
| ISAACLAB_DIR="$PROJECT_ROOT/third_party/IsaacLab" | ||
|
|
||
| if [ -d "$ISAACLAB_DIR" ]; then | ||
| echo "IsaacLab directory already exists at $ISAACLAB_DIR. Skipping clone. Will use existing." | ||
| else | ||
| echo "Cloning IsaacLab repository into $ISAACLAB_DIR..." | ||
| git clone -b v2.0.2 [email protected]:isaac-sim/IsaacLab.git "$ISAACLAB_DIR" | ||
| fi | ||
|
|
||
| pushd "$ISAACLAB_DIR" | ||
| echo "Installing IsaacLab ..." | ||
| yes Yes | ./isaaclab.sh --install | ||
| popd | ||
|
|
||
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,97 @@ | ||
| #!/bin/bash | ||
|
|
||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # 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. | ||
|
|
||
| set -e | ||
|
|
||
| # Assuming this script is in tools/env_setup/ | ||
| PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd ../.. && pwd)" | ||
|
|
||
| # Assuming bash_utils.sh is in $PROJECT_ROOT/tools/env_setup/bash_utils.sh | ||
| source "$PROJECT_ROOT/tools/env_setup/bash_utils.sh" | ||
|
|
||
| check_project_root | ||
|
|
||
| echo "Cloning OpenPI repository..." | ||
| OPENPI_DIR="$PROJECT_ROOT/third_party/openpi" | ||
|
|
||
| if [ -d "$OPENPI_DIR" ]; then | ||
| echo "OpenPI directory already exists at $OPENPI_DIR. Skipping clone." | ||
| exit 1 | ||
| else | ||
| git clone [email protected]:Physical-Intelligence/openpi.git "$OPENPI_DIR" | ||
| fi | ||
|
|
||
| pushd "$OPENPI_DIR" | ||
| git checkout 581e07d73af36d336cef1ec9d7172553b2332193 | ||
|
|
||
| # Update python version in pyproject.toml | ||
| pyproject_path="$OPENPI_DIR/pyproject.toml" | ||
| echo "Patching OpenPI pyproject.toml..." | ||
| sed -i.bak \ | ||
| -e 's/requires-python = ">=3.11"/requires-python = ">=3.10"/' \ | ||
| -e 's/"s3fs>=2024.9.0"/"s3fs==2024.9.0"/' \ | ||
| "$pyproject_path" | ||
|
|
||
| # Apply temporary workaround for openpi/src/openpi/shared/download.py | ||
| file_path="$OPENPI_DIR/src/openpi/shared/download.py" | ||
| echo "Patching OpenPI download.py..." | ||
| # Comment out specific import lines | ||
| sed -i.bak \ | ||
| -e 's/^import boto3\.s3\.transfer as s3_transfer/# import boto3.s3.transfer as s3_transfer/' \ | ||
| -e 's/^import s3transfer\.futures as s3_transfer_futures/# import s3transfer.futures as s3_transfer_futures/' \ | ||
| -e 's/^from types_boto3_s3\.service_resource import ObjectSummary/# from types_boto3_s3.service_resource import ObjectSummary/' \ | ||
| "$file_path" | ||
| # Remove the type hint | ||
| sed -i.bak -e 's/)[[:space:]]*-> s3_transfer\.TransferManager[[:space:]]*:/):/' "$file_path" | ||
| # Modify the datetime line | ||
| sed -i.bak -e 's/datetime\.UTC/datetime.timezone.utc/' "$file_path" | ||
|
|
||
| # Modify the type hints in training/utils.py to use Any instead of optax types | ||
| utils_path="$OPENPI_DIR/src/openpi/training/utils.py" | ||
| echo "Patching OpenPI utils.py..." | ||
| sed -i.bak \ | ||
| -e 's/opt_state: optax\.OptState/opt_state: Any/' \ | ||
| "$utils_path" | ||
|
|
||
| # Remove the backup files | ||
| rm "$pyproject_path.bak" "$file_path.bak" "$utils_path.bak" | ||
|
|
||
| # Add training script to openpi module | ||
| echo "Copying OpenPI utility scripts..." | ||
| if [ ! -f src/openpi/train.py ]; then | ||
| cp scripts/train.py src/openpi/train.py | ||
| fi | ||
| if [ ! -f src/openpi/compute_norm_stats.py ]; then | ||
| cp scripts/compute_norm_stats.py src/openpi/compute_norm_stats.py | ||
| fi | ||
|
|
||
| popd # Back to PROJECT_ROOT | ||
|
|
||
| echo "Installing OpenPI Client..." | ||
| pip install -e $OPENPI_DIR/packages/openpi-client/ | ||
| echo "Installing OpenPI Core..." | ||
| pip install -e $OPENPI_DIR/ | ||
|
|
||
| # Revert the "import changes of "$file_path after installation to prevent errors | ||
| echo "Reverting temporary patches in OpenPI download.py..." | ||
| file_path_revert="$OPENPI_DIR/src/openpi/shared/download.py" | ||
| sed -i \ | ||
| -e 's/^# import boto3\.s3\.transfer as s3_transfer/import boto3.s3.transfer as s3_transfer/' \ | ||
| -e 's/^# import s3transfer\.futures as s3_transfer_futures/import s3transfer.futures as s3_transfer_futures/' \ | ||
| -e 's/^# from types_boto3_s3\.service_resource import ObjectSummary/from types_boto3_s3.service_resource import ObjectSummary/' \ | ||
| "$file_path_revert" | ||
| echo "PI0 Dependencies installed." |
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.
Uh oh!
There was an error while loading. Please reload this page.