|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ARG BASE_IMAGE=nvcr.io/nvidia/pytorch:24.07-py3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FROM ${BASE_IMAGE} as nemo-deps |
|
|
|
|
|
|
|
|
|
|
|
ARG REQUIRE_TORCHAUDIO=false |
|
|
|
|
|
ARG REQUIRE_K2=false |
|
|
|
|
|
ARG REQUIRE_AIS_CLI=false |
|
|
|
|
|
ARG REQUIRE_CHECK_IMPORTS=true |
|
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive |
|
|
|
|
|
RUN apt-get update && \ |
|
|
apt-get upgrade -y && \ |
|
|
apt-get install -y \ |
|
|
libsndfile1 sox \ |
|
|
libfreetype6 \ |
|
|
libsox-fmt-all \ |
|
|
swig \ |
|
|
ffmpeg \ |
|
|
libavdevice-dev && \ |
|
|
rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
|
|
|
|
|
|
RUN apt-get update && \ |
|
|
apt-get install -y \ |
|
|
libtool \ |
|
|
libltdl-dev \ |
|
|
automake \ |
|
|
autoconf \ |
|
|
bison \ |
|
|
flex \ |
|
|
tcl \ |
|
|
ghostscript \ |
|
|
libgd-dev \ |
|
|
fontconfig \ |
|
|
libcairo2-dev \ |
|
|
libpango1.0-dev \ |
|
|
libgts-dev && \ |
|
|
rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
WORKDIR /workspace/ |
|
|
|
|
|
ARG TE_TAG=7d576ed25266a17a7b651f2c12e8498f67e0baea |
|
|
ARG MCORE_TAG=338af51452a53982d202e8386db6233adad1ce86 |
|
|
ARG APEX_TAG=810ffae374a2b9cb4b5c5e28eaeca7d7998fca0c |
|
|
|
|
|
|
|
|
RUN git clone https://github.com/NVIDIA/Megatron-LM.git && \ |
|
|
cd Megatron-LM && \ |
|
|
git checkout ${MCORE_TAG} && \ |
|
|
pip install . |
|
|
|
|
|
|
|
|
RUN git clone https://github.com/NVIDIA/apex.git && \ |
|
|
cd apex && \ |
|
|
git checkout ${APEX_TAG} && \ |
|
|
pip install -v --no-build-isolation --disable-pip-version-check --no-cache-dir \ |
|
|
--config-settings "--build-option=--cpp_ext --cuda_ext --fast_layer_norm --distributed_adam --deprecated_fused_adam" ./ |
|
|
|
|
|
|
|
|
RUN git clone https://github.com/NVIDIA/TransformerEngine.git && \ |
|
|
cd TransformerEngine && \ |
|
|
git fetch origin ${TE_TAG} && \ |
|
|
git checkout FETCH_HEAD && \ |
|
|
git submodule init && git submodule update && \ |
|
|
NVTE_FRAMEWORK=pytorch NVTE_WITH_USERBUFFERS=1 MPI_HOME=/usr/local/mpi pip install . |
|
|
|
|
|
WORKDIR /tmp/ |
|
|
|
|
|
|
|
|
RUN pip3 uninstall -y sacrebleu torchtext |
|
|
|
|
|
|
|
|
WORKDIR /tmp/torchaudio_build |
|
|
COPY scripts/installers /tmp/torchaudio_build/scripts/installers/ |
|
|
RUN INSTALL_MSG=$(/bin/bash /tmp/torchaudio_build/scripts/installers/install_torchaudio_latest.sh); INSTALL_CODE=$?; \ |
|
|
echo ${INSTALL_MSG}; \ |
|
|
if [ ${INSTALL_CODE} -ne 0 ]; then \ |
|
|
echo "torchaudio installation failed"; \ |
|
|
if [ "${REQUIRE_TORCHAUDIO}" = true ]; then \ |
|
|
exit ${INSTALL_CODE}; \ |
|
|
else echo "Skipping failed torchaudio installation"; fi \ |
|
|
else echo "torchaudio installed successfully"; fi |
|
|
|
|
|
COPY scripts /tmp/nemo/scripts/ |
|
|
|
|
|
RUN INSTALL_MSG=$(/bin/bash /tmp/nemo/scripts/installers/install_graphviz.sh --docker); INSTALL_CODE=$?; \ |
|
|
echo ${INSTALL_MSG}; \ |
|
|
if [ ${INSTALL_CODE} -ne 0 ]; then \ |
|
|
echo "graphviz installation failed"; \ |
|
|
if [ "${REQUIRE_K2}" = true ]; then \ |
|
|
exit ${INSTALL_CODE}; \ |
|
|
else echo "Skipping failed graphviz installation"; fi \ |
|
|
else echo "graphviz installed successfully"; fi |
|
|
|
|
|
|
|
|
COPY scripts /tmp/nemo/scripts/ |
|
|
RUN INSTALL_MSG=$(/bin/bash /tmp/nemo/scripts/installers/install_k2.sh); INSTALL_CODE=$?; \ |
|
|
echo ${INSTALL_MSG}; \ |
|
|
if [ ${INSTALL_CODE} -ne 0 ]; then \ |
|
|
echo "k2 installation failed"; \ |
|
|
if [ "${REQUIRE_K2}" = true ]; then \ |
|
|
exit ${INSTALL_CODE}; \ |
|
|
else echo "Skipping failed k2 installation"; fi \ |
|
|
else echo "k2 installed successfully"; fi |
|
|
|
|
|
|
|
|
WORKDIR /tmp/nemo |
|
|
ENV LHOTSE_REQUIRE_TORCHAUDIO=0 |
|
|
COPY requirements . |
|
|
|
|
|
RUN for f in $(ls requirements*.txt | grep -v 'requirements_vllm.txt'); do \ |
|
|
pip3 install --disable-pip-version-check --no-cache-dir -r $f; done |
|
|
|
|
|
|
|
|
RUN pip install flash-attn |
|
|
|
|
|
RUN pip install numba>=0.57.1 |
|
|
|
|
|
|
|
|
FROM scratch as nemo-src |
|
|
COPY . . |
|
|
|
|
|
|
|
|
FROM nemo-deps as nemo |
|
|
ARG NEMO_VERSION=2.0.0 |
|
|
|
|
|
|
|
|
|
|
|
RUN /usr/bin/test -n "$NEMO_VERSION" && \ |
|
|
/bin/echo "export NEMO_VERSION=${NEMO_VERSION}" >> /root/.bashrc && \ |
|
|
/bin/echo "export BASE_IMAGE=${BASE_IMAGE}" >> /root/.bashrc |
|
|
|
|
|
|
|
|
RUN --mount=from=nemo-src,target=/tmp/nemo,rw cd /tmp/nemo && pip install ".[all]" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RUN CHECK_MSG=$(export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${CUDA_HOME}/compat/lib.real && \ |
|
|
python -c "import nemo.collections.asr as nemo_asr" && \ |
|
|
python -c "import nemo.collections.nlp as nemo_nlp" && \ |
|
|
python -c "import nemo.collections.tts as nemo_tts" && \ |
|
|
python -c "import nemo_text_processing.text_normalization as text_normalization"); CHECK_CODE=$?; \ |
|
|
echo ${CHECK_MSG}; \ |
|
|
if [ ${CHECK_CODE} -ne 0 ]; then \ |
|
|
echo "Import check failed"; \ |
|
|
if [ "${REQUIRE_CHECK_IMPORTS}" = true ]; then \ |
|
|
exit ${CHECK_CODE}; \ |
|
|
else echo "Skipping unsuccessful import check"; fi \ |
|
|
else echo "Import check success"; fi |
|
|
|
|
|
|
|
|
|
|
|
WORKDIR /workspace/nemo |
|
|
COPY scripts /workspace/nemo/scripts |
|
|
COPY examples /workspace/nemo/examples |
|
|
COPY tests /workspace/nemo/tests |
|
|
COPY tutorials /workspace/nemo/tutorials |
|
|
|
|
|
|
|
|
RUN printf " |
|
|
chmod +x start-jupyter.sh |
|
|
|
|
|
|
|
|
RUN INSTALL_MSG=$(/bin/bash /tmp/nemo/scripts/installers/install_ais_cli_latest.sh && pip install aistore); INSTALL_CODE=$?; \ |
|
|
echo ${INSTALL_MSG}; \ |
|
|
if [ ${INSTALL_CODE} -ne 0 ]; then \ |
|
|
echo "AIS CLI installation failed"; \ |
|
|
if [ "${REQUIRE_AIS_CLI}" = true ]; then \ |
|
|
exit ${INSTALL_CODE}; \ |
|
|
else echo "Skipping AIS CLI installation"; fi \ |
|
|
else echo "AIS CLI installed successfully"; fi |
|
|
|