|
|
|
|
|
FROM nvidia/cuda:12.6.2-cudnn-runtime-ubuntu22.04 |
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \ |
|
|
cuda-libraries-12-4 && rm -rf /var/lib/apt/lists/* |
|
|
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/cuda-12.4/lib64:/usr/local/cuda-12.4/compat:/usr/local/cuda/targets/x86_64-linux/lib:${LD_LIBRARY_PATH} |
|
|
RUN ln -sf /usr/local/cuda/targets/x86_64-linux/lib /usr/local/cuda/lib64 || true |
|
|
|
|
|
|
|
|
RUN set -eux; \ |
|
|
apt-get update && apt-get install -y --no-install-recommends gnupg ca-certificates curl; \ |
|
|
install -d -m 0755 /usr/share/keyrings; \ |
|
|
curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub \ |
|
|
| gpg --batch --yes --dearmor -o /usr/share/keyrings/cuda-archive-keyring.gpg; \ |
|
|
apt-get update; \ |
|
|
apt-mark unhold libcudnn9-cuda-12 || true; \ |
|
|
apt-get install -y --no-install-recommends \ |
|
|
'libcudnn9-cuda-12=9.8.*' \ |
|
|
'libcudnn9-dev-cuda-12=9.8.*' \ |
|
|
--allow-downgrades --allow-change-held-packages; \ |
|
|
apt-mark hold libcudnn9-cuda-12 || true; \ |
|
|
ldconfig; \ |
|
|
rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
|
|
|
ENV LD_PRELOAD=/usr/local/cuda/lib64/libcusparse.so.12:/usr/local/cuda/lib64/libcublas.so.12:/usr/local/cuda/lib64/libcublasLt.so.12:/usr/local/cuda/lib64/libcufft.so.11:/usr/local/cuda/lib64/libcusolver.so.11 |
|
|
ENV TF_GPU_ALLOCATOR=cuda_malloc_async |
|
|
ENV TF_ENABLE_CUBLAS_TF32=1 NVIDIA_TF32_OVERRIDE=1 |
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive \ |
|
|
PYTHONUNBUFFERED=1 \ |
|
|
PIP_NO_CACHE_DIR=1 \ |
|
|
TF_FORCE_GPU_ALLOW_GROWTH=true \ |
|
|
XLA_PYTHON_CLIENT_PREALLOCATE=false \ |
|
|
JAX_PLATFORMS="" |
|
|
|
|
|
SHELL ["/bin/bash", "-c"] |
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \ |
|
|
software-properties-common curl ca-certificates \ |
|
|
build-essential pkg-config git \ |
|
|
libsndfile1 ffmpeg \ |
|
|
&& add-apt-repository ppa:deadsnakes/ppa -y \ |
|
|
&& apt-get update && apt-get install -y --no-install-recommends \ |
|
|
python3.11 python3.11-dev python3.11-venv python3-pip \ |
|
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
|
|
|
RUN ln -sf /usr/bin/python3.11 /usr/bin/python && \ |
|
|
ln -sf /usr/bin/python3.11 /usr/bin/python3 && \ |
|
|
python -m pip install --upgrade pip && \ |
|
|
python -m pip install uv |
|
|
|
|
|
|
|
|
|
|
|
RUN uv pip install --system tf-nightly |
|
|
|
|
|
|
|
|
RUN uv pip install --system "jax[cuda12]" jaxlib |
|
|
|
|
|
|
|
|
RUN uv pip install --system \ |
|
|
absl-py chex gin-config numpy requests tqdm typing-extensions \ |
|
|
google-cloud-storage librosa resampy soundfile sentencepiece |
|
|
|
|
|
|
|
|
RUN git clone https://github.com/google-research/t5x.git /t5x && \ |
|
|
cd /t5x && \ |
|
|
git checkout 92c5b467a5964d06c351c7eae4aa4bcd341c7ded && \ |
|
|
uv pip install --system --no-deps -e . |
|
|
|
|
|
|
|
|
RUN git clone https://github.com/google/flaxformer.git /flaxformer && \ |
|
|
cd /flaxformer && \ |
|
|
git checkout 399ea3a && \ |
|
|
uv pip install --system --no-deps -e . |
|
|
|
|
|
|
|
|
RUN git clone https://github.com/google/seqio.git /seqio && \ |
|
|
cd /seqio && \ |
|
|
uv pip install --system --no-deps -e . && \ |
|
|
|
|
|
sed -i '/import tensorflow_text as tf_text/d' /seqio/seqio/vocabularies.py |
|
|
|
|
|
|
|
|
RUN git clone https://github.com/google/airio.git /airio && \ |
|
|
cd /airio && \ |
|
|
uv pip install --system --no-deps -e . |
|
|
|
|
|
|
|
|
RUN git clone https://github.com/google/CommonLoopUtils.git /clu && \ |
|
|
cd /clu && \ |
|
|
uv pip install --system --no-deps -e . |
|
|
|
|
|
|
|
|
RUN uv pip install --system \ |
|
|
flax optax orbax-checkpoint \ |
|
|
fiddle cached_property tf2jax \ |
|
|
aqtp etils jestimator \ |
|
|
tensorflow-datasets tfds-nightly \ |
|
|
apache-beam pyyaml rouge-score sacrebleu scipy \ |
|
|
grain-nightly editdistance pyglove |
|
|
|
|
|
|
|
|
RUN sed -i 's|from jax.experimental.pjit import PartitionSpec|from jax.sharding import PartitionSpec|g' \ |
|
|
/usr/local/lib/python3.11/dist-packages/jestimator/amos_helper.py || \ |
|
|
sed -i 's|from jax.experimental.pjit import PartitionSpec|from jax.sharding import PartitionSpec|g' \ |
|
|
/usr/lib/python3.11/dist-packages/jestimator/amos_helper.py || true |
|
|
|
|
|
|
|
|
RUN git clone https://github.com/magenta/magenta-realtime.git /magenta-realtime-src && \ |
|
|
cd /magenta-realtime-src && \ |
|
|
uv pip install --system --no-deps -e . |
|
|
|
|
|
|
|
|
RUN uv pip install --system \ |
|
|
fastapi uvicorn[standard] python-multipart \ |
|
|
pyloudnorm gradio soxr huggingface_hub |
|
|
|
|
|
|
|
|
RUN uv pip install --system --force-reinstall "protobuf>=5.27.0" |
|
|
|
|
|
|
|
|
RUN useradd -m -u 1000 appuser |
|
|
WORKDIR /home/appuser/app |
|
|
|
|
|
|
|
|
ENV MAGENTA_RT_CACHE_DIR=/home/appuser/.cache/magenta_rt |
|
|
RUN mkdir -p $MAGENTA_RT_CACHE_DIR && chown -R appuser:appuser /home/appuser/.cache |
|
|
|
|
|
|
|
|
COPY --chown=appuser:appuser app.py /home/appuser/app/ |
|
|
COPY --chown=appuser:appuser utils.py /home/appuser/app/ |
|
|
COPY --chown=appuser:appuser jam_worker.py /home/appuser/app/ |
|
|
COPY --chown=appuser:appuser one_shot_generation.py /home/appuser/app/ |
|
|
COPY --chown=appuser:appuser model_management.py /home/appuser/app/ |
|
|
COPY --chown=appuser:appuser documentation.html /home/appuser/app/ |
|
|
COPY --chown=appuser:appuser lil_demo_540p.mp4 /home/appuser/app/ |
|
|
COPY --chown=appuser:appuser magentaRT_rt_tester.html /home/appuser/app/ |
|
|
COPY --chown=appuser:appuser magenta_prompts.js /home/appuser/app/ |
|
|
COPY --chown=appuser:appuser docs/ /home/appuser/app/docs/ |
|
|
|
|
|
USER appuser |
|
|
|
|
|
EXPOSE 7860 |
|
|
CMD ["bash", "-lc", "python -m uvicorn app:app --host 0.0.0.0 --port ${PORT:-7860}"] |