Pointcept / PointTransformerV3

[CVPR'24 Oral] Official repository of Point Transformer V3 (PTv3)
MIT License
713 stars 40 forks source link

pure pip based installation? #81

Open AruniRC opened 1 month ago

AruniRC commented 1 month ago

Thank you for the great resource!

Can this be installed purely via pip, as python packages or pre-built wheels, without requiring conda? This makes local installs much less messy.

Gofinge commented 3 weeks ago

Thank you for the great resource!

Can this be installed purely via pip, as python packages or pre-built wheels, without requiring conda? This makes local installs much less messy.

Yes, absolutely. Refer to the following code:

POINTCEPT_VERSION=1.5.0
TORCH_VERSION=2.0.1
CUDA_VERSION=11.7
CUDNN_VERSION=8

ARGS=`getopt -o v:t:c: -l version:,torch:,cuda:,cudnn: -n "$0" -- "$@"`
[ $? != 0 ] && exit 1
eval set -- "${ARGS}"
while true ; do
  case "$1" in
    -v | --version)
      POINTCEPT_VERSION=$2
      shift 2
      ;;
    -t | --torch)
      TORCH_VERSION=$2
      shift 2
      ;;
    -c | --cuda)
      CUDA_VERSION=$2
      shift 2
      ;;
    --cudnn)
      CUDNN_VERSION=$2
      shift 2
      ;;
    --)
      break
      ;;
    *)
      echo "Invalid option: $1"
      exit 1
      ;;
  esac
done

CUDA_VERSION_NO_DOT=`echo ${CUDA_VERSION} | tr -d "."`
BASE_TORCH_TAG=${TORCH_VERSION}-cuda${CUDA_VERSION}-cudnn${CUDNN_VERSION}-devel
IMG_TAG=pointcept/pointcept:v${POINTCEPT_VERSION}-pytorch${BASE_TORCH_TAG}

echo "POINTCEPT VERSION: ${POINTCEPT_VERSION}"
echo "TORCH VERSION: ${TORCH_VERSION}"
echo "CUDA VERSION: ${CUDA_VERSION}"
echo "CUDNN VERSION: ${CUDNN_VERSION}"

cat > ./Dockerfile <<- EOM
FROM pytorch/pytorch:${BASE_TORCH_TAG}

# Fix nvidia-key error issue (NO_PUBKEY A4B469963BF863CC)
RUN rm /etc/apt/sources.list.d/*.list

# Installing apt packages
RUN export DEBIAN_FRONTEND=noninteractive \
    && apt -y update --no-install-recommends \
    && apt -y install --no-install-recommends \
      git wget tmux vim zsh build-essential cmake ninja-build libopenblas-dev libsparsehash-dev \
    && apt autoremove -y \
    && apt clean -y \
    && export DEBIAN_FRONTEND=dialog

# Install Pointcept base environment
RUN pip install --upgrade pip
RUN pip install h5py pyyaml sharedarray tensorboard tensorboardx yapf addict einops scipy plyfile termcolor timm ftfy regex tqdm
RUN conda install pytorch-cluster pytorch-scatter pytorch-sparse -c pyg -y
RUN pip install torch-geometric
RUN pip install spconv-cu${CUDA_VERSION_NO_DOT}
RUN pip install git+https://github.com/openai/CLIP.git
RUN pip install -U --index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/Triton-Nightly/pypi/simple/ triton-nightly

# Build pointops
RUN git clone https://github.com/Pointcept/Pointcept.git
RUN TORCH_CUDA_ARCH_LIST="5.2 6.0 6.1 7.0+PTX 8.0" pip install Pointcept/libs/pointops -v

# Build pointgroup_ops
RUN TORCH_CUDA_ARCH_LIST="5.2 6.0 6.1 7.0+PTX 8.0" pip install Pointcept/libs/pointgroup_ops -v

# Build swin3d
RUN TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0+PTX 8.0" pip install -U git+https://github.com/microsoft/Swin3D.git -v

## Build MinkowskiEngine
#RUN git clone https://github.com/NVIDIA/MinkowskiEngine.git
#WORKDIR /workspace/MinkowskiEngine
#RUN TORCH_CUDA_ARCH_LIST="5.2 6.0 6.1 7.0+PTX 8.0" python setup.py install --blas=openblas --force_cuda
#WORKDIR /workspace
EOM

#docker build . -f ./Dockerfile -t $IMG_TAG
docker build . --no-cache -f ./Dockerfile -t $IMG_TAG