| |
| |
| 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="cuda" |
|
|
| 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]==0.7.1" jaxlib |
|
|
| |
| |
| |
| |
| RUN printf "numpy<2\nnumba>=0.57.0\nllvmlite>=0.40.0\n" > /tmp/constraints.txt && \ |
| echo "---- constraints.txt ----" && \ |
| cat /tmp/constraints.txt && \ |
| echo "------------------------" |
|
|
| |
| |
| RUN uv pip install --system -c /tmp/constraints.txt "numpy<2" "numba>=0.57.0" "llvmlite>=0.40.0" |
|
|
| |
| RUN uv pip install --system -c /tmp/constraints.txt \ |
| 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 -c /tmp/constraints.txt \ |
| 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 -c /tmp/constraints.txt \ |
| fastapi uvicorn[standard] python-multipart \ |
| pyloudnorm gradio soxr huggingface_hub |
|
|
| |
| RUN uv pip install --system --force-reinstall "protobuf>=5.27.0" |
|
|
| RUN uv pip install --system fastrtc |
|
|
| |
| WORKDIR /app |
| ENV MAGENTA_RT_CACHE_DIR=/root/.cache/magenta_rt |
| RUN mkdir -p $MAGENTA_RT_CACHE_DIR |
|
|
| |
| COPY app.py /app/ |
| COPY utils.py /app/ |
| COPY jam_worker.py /app/ |
| COPY one_shot_generation.py /app/ |
| COPY model_management.py /app/ |
| COPY documentation.html /app/ |
| COPY lil_demo_540p.mp4 /app/ |
| COPY magentaRT_rt_tester.html /app/ |
| COPY magenta_prompts.js /app/ |
| COPY docs/ /app/docs/ |
| COPY fastrtc_magenta.py /app/ |
|
|
| EXPOSE 7860 |
| CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |