feat(env): Add docker file. (#30)
This commit is contained in:
parent
c258ff8666
commit
a375fa46b5
18
README.md
18
README.md
@ -37,6 +37,20 @@ conda activate embodiedgen
|
|||||||
bash install.sh basic
|
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
|
### ✅ Setup GPT Agent
|
||||||
|
|
||||||
Update the API key in file: `embodied_gen/utils/gpt_config.yaml`.
|
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:
|
|||||||
<h2 id="image-to-3d">🖼️ Image-to-3D</h2>
|
<h2 id="image-to-3d">🖼️ Image-to-3D</h2>
|
||||||
|
|
||||||
[](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.
|
[](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`.)
|
||||||
<img src="apps/assets/image_to_3d.jpg" alt="Image to 3D" width="900">
|
<img src="apps/assets/image_to_3d.jpg" alt="Image to 3D" width="900">
|
||||||
|
|
||||||
### ☁️ Service
|
### ☁️ Service
|
||||||
@ -79,7 +93,7 @@ img3d-cli --image_path apps/assets/example_image/sample_04.jpg apps/assets/examp
|
|||||||
|
|
||||||
<h2 id="text-to-3d">📝 Text-to-3D</h2>
|
<h2 id="text-to-3d">📝 Text-to-3D</h2>
|
||||||
|
|
||||||
[](https://huggingface.co/spaces/HorizonRobotics/EmbodiedGen-Text-to-3D) Create 3D assets from text descriptions for a wide range of geometry and styles.
|
[](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`.)
|
||||||
|
|
||||||
<img src="apps/assets/text_to_3d.jpg" alt="Text to 3D" width="900">
|
<img src="apps/assets/text_to_3d.jpg" alt="Text to 3D" width="900">
|
||||||
|
|
||||||
|
|||||||
38
docker/Dockerfile
Normal file
38
docker/Dockerfile
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
FROM pytorch/pytorch:2.4.0-cuda11.8-cudnn9-devel
|
||||||
|
LABEL maintainer="Horizon Robotics <xinjie.wang@horizon.auto>" \
|
||||||
|
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"]
|
||||||
32
docker/README.md
Normal file
32
docker/README.md
Normal file
@ -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 .
|
||||||
|
```
|
||||||
@ -476,9 +476,9 @@ class PanoHeightEstimator(object):
|
|||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
result = float(result.strip())
|
result = float(result.strip())
|
||||||
except ValueError:
|
except Exception as e:
|
||||||
logger.error(
|
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
|
result = self.default_value
|
||||||
|
|
||||||
|
|||||||
13
install.sh
13
install.sh
@ -8,12 +8,6 @@ SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|||||||
|
|
||||||
source "$SCRIPT_DIR/install/_utils.sh"
|
source "$SCRIPT_DIR/install/_utils.sh"
|
||||||
git config --global http.postBuffer 524288000
|
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 ====="
|
log_info "===== Starting installation stage: $STAGE ====="
|
||||||
|
|
||||||
@ -22,6 +16,13 @@ if [[ "$STAGE" == "basic" || "$STAGE" == "all" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$STAGE" == "extra" || "$STAGE" == "all" ]]; then
|
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"
|
bash "$SCRIPT_DIR/install/install_extra.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@ -3,21 +3,26 @@ set -e
|
|||||||
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||||
source "$SCRIPT_DIR/_utils.sh"
|
source "$SCRIPT_DIR/_utils.sh"
|
||||||
|
|
||||||
try_install "Installing flash-attn..." \
|
PIP_INSTALL_PACKAGES=(
|
||||||
"pip install flash-attn==2.7.0.post2 --no-build-isolation" \
|
"pip==22.3.1"
|
||||||
"flash-attn installation failed."
|
"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..." \
|
for pkg in "${PIP_INSTALL_PACKAGES[@]}"; do
|
||||||
"pip install -r requirements.txt --use-deprecated=legacy-resolver --default-timeout=60" \
|
try_install "Installing $pkg..." \
|
||||||
"requirements installation failed."
|
"pip install $pkg" \
|
||||||
|
"$pkg installation failed."
|
||||||
try_install "Installing kolors..." \
|
done
|
||||||
"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."
|
|
||||||
|
|
||||||
log_info "Installing diff-gaussian-rasterization..."
|
log_info "Installing diff-gaussian-rasterization..."
|
||||||
TMP_DIR="/tmp/mip-splatting"
|
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"
|
pip install "$TMP_DIR/submodules/diff-gaussian-rasterization"
|
||||||
rm -rf "$TMP_DIR"
|
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..." \
|
try_install "Installing EmbodiedGen..." \
|
||||||
"pip install triton==2.1.0 --no-deps && pip install -e ." \
|
"pip install triton==2.1.0 --no-deps && pip install -e ." \
|
||||||
"EmbodiedGen installation failed."
|
"EmbodiedGen installation failed."
|
||||||
|
|||||||
@ -4,24 +4,23 @@ SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|||||||
source "$SCRIPT_DIR/_utils.sh"
|
source "$SCRIPT_DIR/_utils.sh"
|
||||||
|
|
||||||
PYTHON_PACKAGES_NODEPS=(
|
PYTHON_PACKAGES_NODEPS=(
|
||||||
timm
|
"timm"
|
||||||
txt2panoimg@git+https://github.com/HochCC/SD-T2I-360PanoImage
|
"txt2panoimg@git+https://github.com/HochCC/SD-T2I-360PanoImage"
|
||||||
kornia
|
|
||||||
kornia_rs
|
|
||||||
)
|
)
|
||||||
|
|
||||||
PYTHON_PACKAGES=(
|
PYTHON_PACKAGES=(
|
||||||
fused-ssim@git+https://github.com/rahul-goel/fused-ssim#egg=328dc98
|
"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/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch"
|
||||||
git+https://github.com/facebookresearch/pytorch3d.git@v0.7.7
|
"git+https://github.com/facebookresearch/pytorch3d.git@stable"
|
||||||
h5py
|
"kornia"
|
||||||
albumentations==0.5.2
|
"h5py"
|
||||||
webdataset
|
"albumentations==0.5.2"
|
||||||
icecream
|
"webdataset"
|
||||||
open3d
|
"icecream"
|
||||||
pyequilib
|
"open3d"
|
||||||
numpy==1.26.4
|
"pyequilib"
|
||||||
triton==2.1.0
|
"numpy==1.26.4"
|
||||||
|
"triton==2.1.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
for pkg in "${PYTHON_PACKAGES_NODEPS[@]}"; do
|
for pkg in "${PYTHON_PACKAGES_NODEPS[@]}"; do
|
||||||
@ -30,6 +29,8 @@ for pkg in "${PYTHON_PACKAGES_NODEPS[@]}"; do
|
|||||||
"$pkg installation failed."
|
"$pkg installation failed."
|
||||||
done
|
done
|
||||||
|
|
||||||
try_install "Installing other Python dependencies..." \
|
for pkg in "${PYTHON_PACKAGES[@]}"; do
|
||||||
"pip install ${PYTHON_PACKAGES[*]}" \
|
try_install "pip install $pkg..." \
|
||||||
"Python dependencies installation failed."
|
"pip install $pkg" \
|
||||||
|
"$pkg installation failed."
|
||||||
|
done
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
torch==2.4.0+cu118
|
torch==2.4.0
|
||||||
torchvision==0.19.0+cu118
|
torchvision==0.19.0
|
||||||
xformers==0.0.27.post2
|
xformers==0.0.27.post2
|
||||||
pytorch-lightning==2.4.0
|
pytorch-lightning==2.4.0
|
||||||
spconv-cu120==2.3.6
|
spconv-cu120==2.3.6
|
||||||
@ -35,7 +35,7 @@ json-repair
|
|||||||
scikit-learn
|
scikit-learn
|
||||||
omegaconf
|
omegaconf
|
||||||
tyro
|
tyro
|
||||||
utils3d@git+https://github.com/EasternJournalist/utils3d.git#egg=9a4eb15
|
pyquaternion
|
||||||
clip@git+https://github.com/openai/CLIP.git
|
shapely
|
||||||
segment-anything@git+https://github.com/facebookresearch/segment-anything.git#egg=dca509f
|
sapien==3.0.0b1
|
||||||
nvdiffrast@git+https://github.com/NVlabs/nvdiffrast.git#egg=729261d
|
typing_extensions==4.14.1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user