-
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 1 commit
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
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
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 |
|---|---|---|
|
|
@@ -17,50 +17,39 @@ | |
|
|
||
| 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 | ||
| # Assuming bash_utils.sh is in $PROJECT_ROOT/tools/env_setup/bash_utils.sh | ||
| source "$PROJECT_ROOT/tools/env_setup/bash_utils.sh" | ||
|
|
||
| # Perform necessary checks | ||
| check_project_root | ||
| check_conda_env # Ensure conda environment is still active | ||
|
|
||
| echo "--- Installing PI0 Policy Dependencies ---" # Combined echo | ||
| check_conda_env | ||
mingxin-zheng marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| echo "Cloning OpenPI repository..." | ||
| OPENPI_DIR="$PROJECT_ROOT/third_party/openpi" | ||
|
|
||
| if [ -d "$OPENPI_DIR" ]; then | ||
| echo "OpenPI directory already exists at $OPENPI_DIR. Using existing clone." | ||
| # Optionally, you might want to add a git pull or reset --hard to a specific commit here | ||
| # For now, we assume if it exists, its state is managed or acceptable for re-running patches/install. | ||
| echo "OpenPI directory already exists at $OPENPI_DIR. Skipping clone." | ||
| exit 1 | ||
| else | ||
| echo "Cloning OpenPI repository into $OPENPI_DIR..." | ||
| # Ensure parent third_party dir exists | ||
| mkdir -p "$PROJECT_ROOT/third_party" | ||
| git clone [email protected]:Physical-Intelligence/openpi.git "$OPENPI_DIR" | ||
| fi | ||
|
|
||
| pushd "$OPENPI_DIR" | ||
| # Checkout the specific commit regardless of whether it was just cloned or already existed | ||
| echo "Ensuring OpenPI is on commit 581e07d..." | ||
| git fetch origin --tags # Ensure commit is available | ||
| git checkout 581e07d73af36d336cef1ec9d7172553b2332193 | ||
|
|
||
| # Update python version in pyproject.toml | ||
| pyproject_path="$OPENPI_DIR/pyproject.toml" | ||
| echo "Patching OpenPI pyproject.toml ($pyproject_path)..." | ||
| 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 ($file_path)..." | ||
| 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/' \ | ||
|
|
@@ -74,13 +63,13 @@ 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 ($utils_path)..." | ||
| echo "Patching OpenPI utils.py..." | ||
| sed -i.bak \ | ||
| -e 's/opt_state: optax\.OptState/opt_state: Any/' \ | ||
| "$utils_path" | ||
|
|
||
| # Remove the backup files if they exist | ||
| rm -f "$pyproject_path.bak" "$file_path.bak" "$utils_path.bak" | ||
| # 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..." | ||
|
|
@@ -91,18 +80,19 @@ if [ ! -f src/openpi/compute_norm_stats.py ]; then | |
| cp scripts/compute_norm_stats.py src/openpi/compute_norm_stats.py | ||
| fi | ||
|
|
||
| popd | ||
| popd # Back to PROJECT_ROOT | ||
|
|
||
| echo "Installing OpenPI Client..." | ||
| pip install -e "$OPENPI_DIR/packages/openpi-client/" | ||
| pip install -e $OPENPI_DIR/packages/openpi-client/ | ||
| echo "Installing OpenPI Core..." | ||
| pip install -e "$OPENPI_DIR/" | ||
| 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)..." | ||
| 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" | ||
| "$file_path_revert" | ||
| echo "PI0 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
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.