diff --git a/README.md b/README.md index 4de144e..f6e507b 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,20 @@ conda activate embodiedgen bash install.sh basic ``` +### ✅ Starting from Docker + +We provide a pre-built Docker image on [Docker Hub](https://hub.docker.com/repository/docker/wangxinjie/embodiedgen) with a configured environment for your convenience. For more details, please refer to [Docker documentation](https://github.com/HorizonRobotics/EmbodiedGen/docker/README.md). + +> **Note:** Model checkpoints are not included in the image, they will be automatically downloaded on first run. You still need to set up the GPT Agent manually. + +```sh +IMAGE=wangxinjie/embodiedgen:env_v0.1.x +CONTAINER=EmbodiedGen-docker-${USER} +docker pull ${IMAGE} +docker run -itd --shm-size="64g" --gpus all --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged --net=host --name ${CONTAINER} ${IMAGE} +docker exec -it ${CONTAINER} bash +``` + ### ✅ Setup GPT Agent Update the API key in file: `embodied_gen/utils/gpt_config.yaml`. @@ -52,7 +66,7 @@ You can choose between two backends for the GPT agent:

🖼️ Image-to-3D

[![🤗 Hugging Face](https://img.shields.io/badge/🤗-Image_to_3D_Demo-blue)](https://huggingface.co/spaces/HorizonRobotics/EmbodiedGen-Image-to-3D) Generate physically plausible 3D asset URDF from single input image, offering high-quality support for digital twin systems. - +(HF space is a simplified demonstration. For the full functionality, please refer to `img3d-cli`.) Image to 3D ### ☁️ Service @@ -79,7 +93,7 @@ img3d-cli --image_path apps/assets/example_image/sample_04.jpg apps/assets/examp

📝 Text-to-3D

-[![🤗 Hugging Face](https://img.shields.io/badge/🤗-Text_to_3D_Demo-blue)](https://huggingface.co/spaces/HorizonRobotics/EmbodiedGen-Text-to-3D) Create 3D assets from text descriptions for a wide range of geometry and styles. +[![🤗 Hugging Face](https://img.shields.io/badge/🤗-Text_to_3D_Demo-blue)](https://huggingface.co/spaces/HorizonRobotics/EmbodiedGen-Text-to-3D) Create 3D assets from text descriptions for a wide range of geometry and styles. (HF space is a simplified demonstration. For the full functionality, please refer to `text3d-cli`.) Text to 3D diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..28356d9 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,38 @@ +FROM pytorch/pytorch:2.4.0-cuda11.8-cudnn9-devel +LABEL maintainer="Horizon Robotics " \ + version="0.1.2" \ + description="Docker image for EmbodiedGen" + +RUN apt-get update && apt-get install -y --no-install-recommends \ + git \ + bash \ + build-essential \ + ninja-build \ + libgl1-mesa-glx \ + libglib2.0-0 \ + libsm6 \ + libxext6 \ + libxrender1 \ + && rm -rf /var/lib/apt/lists/* + +# TORCH_CUDA_ARCH_LIST="8.0;8.9;9.0" -> A100/4090/H100 +ENV CUDA_HOME=/usr/local/cuda-11.8 \ + PATH=/usr/local/cuda-11.8/bin:$PATH \ + LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH \ + DEBIAN_FRONTEND=noninteractive \ + TORCH_CUDA_ARCH_LIST="8.0;8.9;9.0" \ + TCNN_CUDA_ARCHITECTURES=80,89,90 + +RUN useradd -m -s /bin/bash e_user +WORKDIR /EmbodiedGen +COPY . . +RUN chown -R e_user:e_user /EmbodiedGen +USER e_user + +RUN conda create -n embodiedgen python=3.10.13 -y && \ + conda run -n embodiedgen bash install.sh + +RUN /opt/conda/bin/conda init bash && \ + echo "conda activate embodiedgen" >> /home/e_user/.bashrc + +CMD ["bash", "--login"] diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..b10d299 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,32 @@ +# Docker + +## Getting Started with Our Pre-built Docker Image + +We provide pre-built Docker image on [Docker Hub](https://hub.docker.com/repository/docker/wangxinjie/embodiedgen) that includes a configured environment for your convenience. + +```sh +IMAGE=wangxinjie/embodiedgen:env_v0.1.x +CONTAINER=EmbodiedGen-docker-${USER} +docker pull ${IMAGE} +docker run -itd --shm-size="64g" --gpus all --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged --net=host --name ${CONTAINER} ${IMAGE} +docker exec -it ${CONTAINER} bash +# ref `EmbodiedGen/README.md` to get start. +``` + +> **Note**: Model checkpoints are not included in the default image, they will be automatically downloaded on first run. Also, you still need to configure the GPT agent manually. See the [Setup GPT Agent](https://github.com/HorizonRobotics/EmbodiedGen?tab=readme-ov-file#-setup-gpt-agent) section for detailed instructions. + +If you prefer an image with all model checkpoints, you can use `wangxinjie/embodiedgen:v0.1.x`. However, please note that this image is significantly larger. We recommend using the lighter image and allowing the models to download on demand. + + +## Getting Started with Building from the Dockerfile +You can also build your customized docker based on our Dockerfile. + +```sh +git clone https://github.com/HorizonRobotics/EmbodiedGen.git +cd EmbodiedGen +TAG=v0.1.2 # Change to the latest stable version. +git checkout $TAG +git submodule update --init --recursive --progress + +docker build -t embodiedgen:$TAG -f docker/Dockerfile . +``` diff --git a/embodied_gen/validators/quality_checkers.py b/embodied_gen/validators/quality_checkers.py index 4f33cb8..a0498e0 100644 --- a/embodied_gen/validators/quality_checkers.py +++ b/embodied_gen/validators/quality_checkers.py @@ -476,9 +476,9 @@ class PanoHeightEstimator(object): ) try: result = float(result.strip()) - except ValueError: + except Exception as e: logger.error( - f"Parser error: failed convert {result} to float, use default value {self.default_value}." + f"Parser error: failed convert {result} to float, {e}, use default value {self.default_value}." ) result = self.default_value diff --git a/install.sh b/install.sh index f063894..509b391 100644 --- a/install.sh +++ b/install.sh @@ -8,12 +8,6 @@ SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) source "$SCRIPT_DIR/install/_utils.sh" git config --global http.postBuffer 524288000 -# Patch submodule .gitignore to ignore __pycache__, only if submodule exists -PANO2ROOM_PATH="$SCRIPT_DIR/thirdparty/pano2room" -if [ -d "$PANO2ROOM_PATH" ]; then - echo "__pycache__/" > "$PANO2ROOM_PATH/.gitignore" - log_info "Added .gitignore to ignore __pycache__ in $PANO2ROOM_PATH" -fi log_info "===== Starting installation stage: $STAGE =====" @@ -22,6 +16,13 @@ if [[ "$STAGE" == "basic" || "$STAGE" == "all" ]]; then fi if [[ "$STAGE" == "extra" || "$STAGE" == "all" ]]; then + # Patch submodule .gitignore to ignore __pycache__, if submodule exists + PANO2ROOM_PATH="$SCRIPT_DIR/thirdparty/pano2room" + if [ -d "$PANO2ROOM_PATH" ]; then + echo "__pycache__/" > "$PANO2ROOM_PATH/.gitignore" + log_info "Added .gitignore to ignore __pycache__ in $PANO2ROOM_PATH" + fi + bash "$SCRIPT_DIR/install/install_extra.sh" fi diff --git a/install/install_basic.sh b/install/install_basic.sh index 26fce27..dc90446 100644 --- a/install/install_basic.sh +++ b/install/install_basic.sh @@ -3,21 +3,26 @@ set -e SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) source "$SCRIPT_DIR/_utils.sh" -try_install "Installing flash-attn..." \ - "pip install flash-attn==2.7.0.post2 --no-build-isolation" \ - "flash-attn installation failed." +PIP_INSTALL_PACKAGES=( + "pip==22.3.1" + "torch==2.4.0+cu118 torchvision==0.19.0+cu118 --index-url https://download.pytorch.org/whl/cu118" + "xformers==0.0.27.post2 --index-url https://download.pytorch.org/whl/cu118" + "flash-attn==2.7.0.post2 --no-build-isolation" + "-r requirements.txt --use-deprecated=legacy-resolver" + "utils3d@git+https://github.com/EasternJournalist/utils3d.git#egg=9a4eb15" + "clip@git+https://github.com/openai/CLIP.git" + "segment-anything@git+https://github.com/facebookresearch/segment-anything.git#egg=dca509f" + "nvdiffrast@git+https://github.com/NVlabs/nvdiffrast.git#egg=729261d" + "kolors@git+https://github.com/HochCC/Kolors.git" + "kaolin@git+https://github.com/NVIDIAGameWorks/kaolin.git@v0.16.0" + "git+https://github.com/nerfstudio-project/gsplat.git@v1.5.3" +) -try_install "Installing requirements.txt..." \ - "pip install -r requirements.txt --use-deprecated=legacy-resolver --default-timeout=60" \ - "requirements installation failed." - -try_install "Installing kolors..." \ - "pip install kolors@git+https://github.com/HochCC/Kolors.git" \ - "kolors installation failed." - -try_install "Installing kaolin..." \ - "pip install kaolin@git+https://github.com/NVIDIAGameWorks/kaolin.git@v0.16.0" \ - "kaolin installation failed." +for pkg in "${PIP_INSTALL_PACKAGES[@]}"; do + try_install "Installing $pkg..." \ + "pip install $pkg" \ + "$pkg installation failed." +done log_info "Installing diff-gaussian-rasterization..." TMP_DIR="/tmp/mip-splatting" @@ -26,10 +31,6 @@ git clone --recursive https://github.com/autonomousvision/mip-splatting.git "$TM pip install "$TMP_DIR/submodules/diff-gaussian-rasterization" rm -rf "$TMP_DIR" -try_install "Installing gsplat..." \ - "pip install git+https://github.com/nerfstudio-project/gsplat.git@v1.5.3" \ - "gsplat installation failed." - try_install "Installing EmbodiedGen..." \ "pip install triton==2.1.0 --no-deps && pip install -e ." \ "EmbodiedGen installation failed." diff --git a/install/install_extra.sh b/install/install_extra.sh index 024f030..6764e95 100644 --- a/install/install_extra.sh +++ b/install/install_extra.sh @@ -4,24 +4,23 @@ SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) source "$SCRIPT_DIR/_utils.sh" PYTHON_PACKAGES_NODEPS=( - timm - txt2panoimg@git+https://github.com/HochCC/SD-T2I-360PanoImage - kornia - kornia_rs + "timm" + "txt2panoimg@git+https://github.com/HochCC/SD-T2I-360PanoImage" ) PYTHON_PACKAGES=( - fused-ssim@git+https://github.com/rahul-goel/fused-ssim#egg=328dc98 - git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch - git+https://github.com/facebookresearch/pytorch3d.git@v0.7.7 - h5py - albumentations==0.5.2 - webdataset - icecream - open3d - pyequilib - numpy==1.26.4 - triton==2.1.0 + "fused-ssim@git+https://github.com/rahul-goel/fused-ssim#egg=328dc98" + "git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch" + "git+https://github.com/facebookresearch/pytorch3d.git@stable" + "kornia" + "h5py" + "albumentations==0.5.2" + "webdataset" + "icecream" + "open3d" + "pyequilib" + "numpy==1.26.4" + "triton==2.1.0" ) for pkg in "${PYTHON_PACKAGES_NODEPS[@]}"; do @@ -30,6 +29,8 @@ for pkg in "${PYTHON_PACKAGES_NODEPS[@]}"; do "$pkg installation failed." done -try_install "Installing other Python dependencies..." \ - "pip install ${PYTHON_PACKAGES[*]}" \ - "Python dependencies installation failed." +for pkg in "${PYTHON_PACKAGES[@]}"; do + try_install "pip install $pkg..." \ + "pip install $pkg" \ + "$pkg installation failed." +done diff --git a/requirements.txt b/requirements.txt index 47854cf..4c9fdf9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -torch==2.4.0+cu118 -torchvision==0.19.0+cu118 +torch==2.4.0 +torchvision==0.19.0 xformers==0.0.27.post2 pytorch-lightning==2.4.0 spconv-cu120==2.3.6 @@ -35,7 +35,7 @@ json-repair scikit-learn omegaconf tyro -utils3d@git+https://github.com/EasternJournalist/utils3d.git#egg=9a4eb15 -clip@git+https://github.com/openai/CLIP.git -segment-anything@git+https://github.com/facebookresearch/segment-anything.git#egg=dca509f -nvdiffrast@git+https://github.com/NVlabs/nvdiffrast.git#egg=729261d +pyquaternion +shapely +sapien==3.0.0b1 +typing_extensions==4.14.1