Dockerfile.rocm 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. FROM rocm/pytorch:rocm5.7_ubuntu22.04_py3.10_pytorch_2.0.1
  2. # Install some basic utilities
  3. RUN apt-get update && apt-get install python3 python3-pip -y
  4. # Install some basic utilities
  5. RUN apt-get update && apt-get install -y \
  6. curl \
  7. ca-certificates \
  8. sudo \
  9. git \
  10. bzip2 \
  11. libx11-6 \
  12. build-essential \
  13. wget \
  14. unzip \
  15. nvidia-cuda-toolkit \
  16. tmux \
  17. && rm -rf /var/lib/apt/lists/*
  18. ### Mount Point ###
  19. # When launching the container, mount the code directory to /app
  20. ARG APP_MOUNT=/app
  21. VOLUME [ ${APP_MOUNT} ]
  22. WORKDIR ${APP_MOUNT}
  23. RUN python3 -m pip install --upgrade pip
  24. RUN python3 -m pip install --no-cache-dir fastapi ninja tokenizers pandas
  25. ENV LLVM_SYMBOLIZER_PATH=/opt/rocm/llvm/bin/llvm-symbolizer
  26. ENV PATH=$PATH:/opt/rocm/bin:/libtorch/bin:
  27. ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/lib/:/libtorch/lib:
  28. ENV CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/libtorch/include:/libtorch/include/torch/csrc/api/include/:/opt/rocm/include/:
  29. # Install ROCm flash-attention
  30. RUN mkdir libs \
  31. && cd libs \
  32. && git clone https://github.com/ROCmSoftwarePlatform/flash-attention.git \
  33. && cd flash-attention \
  34. && git checkout 3d2b6f5 \
  35. && git submodule update --init \
  36. && export GPU_ARCHS=$(/opt/rocm/llvm/bin/amdgpu-offload-arch) \
  37. && patch /opt/conda/envs/py_3.10/lib/python3.10/site-packages/torch/utils/hipify/hipify_python.py hipify_patch.patch \
  38. && python3 setup.py install \
  39. && cd ..
  40. COPY ./ /app/aphrodite-engine
  41. RUN python3 -m pip install --upgrade pip
  42. RUN pip install xformers==0.0.22.post7 --no-deps
  43. RUN cd /app \
  44. && cd aphrodite-engine \
  45. && pip install -U -r requirements-rocm.txt \
  46. && bash patch_xformers-0.0.22.post7.rocm.sh \
  47. && python3 setup.py install \
  48. && cd ..
  49. RUN python3 -m pip install --upgrade pip
  50. RUN python3 -m pip install --no-cache-dir ray[all]
  51. CMD ["/bin/bash"]