Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions tools/env_setup/install_cosmos_transfer1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ set -e
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 if needed by this script, e.g.:
check_project_root
check_conda_env

Expand All @@ -44,6 +42,7 @@ 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
Expand Down
6 changes: 1 addition & 5 deletions tools/env_setup/install_gr00tn1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ set -e
# 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
check_conda_env

echo "--- Installing GR00T N1 Policy Dependencies ---"

Expand All @@ -43,8 +41,6 @@ else
fi

pushd "$GR00T_DIR"
# Note: The original script did not specify a commit for Isaac-GR00T.
# If a specific commit becomes necessary, add a git checkout here.

# Update pyav dependency in pyproject.toml if not already done
if grep -q "pyav" pyproject.toml; then
Expand Down
2 changes: 0 additions & 2 deletions tools/env_setup/install_holoscan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ set -e
# 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 if needed by this script, e.g.:
check_project_root
check_conda_env

Expand Down
1 change: 0 additions & 1 deletion tools/env_setup/install_isaac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ check_conda_env
# Check if NVIDIA GPU is available
check_nvidia_gpu


# Ensure the parent third_party directory exists
mkdir -p "$PROJECT_ROOT/third_party"

Expand Down
40 changes: 15 additions & 25 deletions tools/env_setup/install_pi0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

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/' \
Expand All @@ -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..."
Expand All @@ -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."
2 changes: 1 addition & 1 deletion tools/env_setup_robot_surgery.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
set -e

# Get the parent directory of the current script
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd .. && pwd)"
source "$PROJECT_ROOT/tools/env_setup/bash_utils.sh"

# Check if running in a conda environment
Expand Down
Loading