|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ARG BASE_IMAGE=nvcr.io/nvidia/pytorch:23.02-py3 |
|
|
|
|
|
|
|
|
|
FROM ${BASE_IMAGE} as nemo-deps |
|
|
|
|
|
|
|
ARG REQUIRE_TORCHAUDIO=false |
|
|
|
ARG REQUIRE_K2=false |
|
|
|
ARG REQUIRE_AIS_CLI=false |
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive |
|
|
|
RUN apt-get update && \ |
|
apt-get upgrade -y && \ |
|
apt-get install -y \ |
|
libsndfile1 sox \ |
|
libfreetype6 \ |
|
swig \ |
|
ffmpeg \ |
|
libavdevice-dev && \ |
|
rm -rf /var/lib/apt/lists/* |
|
|
|
WORKDIR /tmp/ |
|
|
|
|
|
|
|
RUN git clone https://github.com/NVIDIA/apex.git && \ |
|
cd apex && \ |
|
git checkout 03c9d80ed54c0eaa5b581bf42ceca3162f085327 && \ |
|
pip3 install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" --global-option="--fast_layer_norm" --global-option="--distributed_adam" --global-option="--deprecated_fused_adam" ./ |
|
|
|
|
|
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 |
|
|
|
|
|
WORKDIR /tmp/nemo |
|
COPY requirements . |
|
RUN for f in $(ls requirements*.txt); do pip3 install --disable-pip-version-check --no-cache-dir -r $f; done |
|
|
|
|
|
COPY scripts /tmp/nemo/scripts/ |
|
RUN INSTALL_MSG=$(/bin/bash /tmp/nemo/scripts/speech_recognition/k2/setup.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 |
|
|
|
|
|
FROM scratch as nemo-src |
|
COPY . . |
|
|
|
|
|
FROM nemo-deps as nemo |
|
ARG NEMO_VERSION=1.17.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 cd /tmp/nemo && pip install ".[all]" |
|
|
|
|
|
RUN 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" |
|
|
|
|
|
|
|
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 "#!/bin/bash\njupyter lab --no-browser --allow-root --ip=0.0.0.0" >> start-jupyter.sh && \ |
|
chmod +x start-jupyter.sh |
|
|
|
|
|
RUN if [ "${REQUIRE_AIS_CLI}" = true ]; then \ |
|
INSTALL_MSG=$(/bin/bash scripts/installers/install_ais_cli_latest.sh); INSTALL_CODE=$?; \ |
|
echo ${INSTALL_MSG}; \ |
|
if [ ${INSTALL_CODE} -ne 0 ]; then \ |
|
echo "AIS CLI installation failed"; \ |
|
exit ${INSTALL_CODE}; \ |
|
else echo "AIS CLI installed successfully"; fi \ |
|
else echo "Skipping AIS CLI installation"; fi |
|
|