Skip to content

Commit acbc21c

Browse files
authored
[build] Update Megatron Dockerfile after torch 2.10 upgrade and transformer-engine upgrade (#1671)
Signed-off-by: SumanthRH <sumanthrh99@gmail.com>
1 parent 354633e commit acbc21c

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

docker/Dockerfile.megatron

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,26 @@ RUN sudo apt-get update && sudo apt-get install -y \
2929

3030
# ---------- PyTorch + cuDNN + Transformer Engine ----------
3131
# PyTorch + cuDNN + Transformer Engine
32-
RUN pip install --no-cache-dir "torch==2.7.1" "nvidia-cudnn-cu12>=9.3" && \
33-
CUDNN_PATH="$(python -c 'import inspect, nvidia.cudnn as c, os; print(os.path.dirname(inspect.getfile(c)))')" && \
32+
RUN uv pip install --system --no-cache-dir "torch==2.10.0" "nvidia-cudnn-cu12>=9.3" && \
33+
CUDNN_PATH="$(python -c 'import nvidia.cudnn as c; print(c.__path__[0])')" && \
3434
sudo mkdir -p /opt && sudo ln -sfn "$CUDNN_PATH" /opt/cudnn && \
3535
echo "/opt/cudnn/lib" | sudo tee /etc/ld.so.conf.d/cudnn.conf >/dev/null && sudo ldconfig
3636

3737
ENV CUDNN_PATH=/opt/cudnn
3838
ENV CPATH=${CUDNN_PATH}/include:${CPATH}
3939
ENV LD_LIBRARY_PATH=${CUDNN_PATH}/lib:${LD_LIBRARY_PATH}
4040

41-
RUN pip install --no-cache-dir \
41+
RUN uv pip install --system --no-cache-dir \
4242
nvidia-mathdx \
4343
pybind11 \
4444
setuptools \
4545
wheel
4646

4747
ENV CMAKE_ARGS=-DPython_EXECUTABLE=/home/ray/anaconda3/bin/python3
4848

49-
RUN pip install --no-cache-dir --no-build-isolation "transformer_engine[pytorch]==2.9.0"
49+
RUN sudo mkdir /opt/wheels && sudo chown ray: /opt/wheels && \
50+
pip wheel --no-cache-dir --no-build-isolation --no-deps \
51+
-w /opt/wheels "transformer-engine-torch==2.10.0"
52+
RUN pip install --no-cache-dir --no-build-isolation --find-links /opt/wheels "transformer_engine[pytorch]==2.10.0"
53+
ENV UV_FIND_LINKS=/opt/wheels
5054
# --------------------

0 commit comments

Comments
 (0)