adityas129 commited on
Commit
433f0ad
·
verified ·
1 Parent(s): 25f5a3a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -47
Dockerfile CHANGED
@@ -1,5 +1,4 @@
1
-
2
- # thecollabagepatch/magenta:latest somewhat working
3
  FROM nvidia/cuda:12.6.2-cudnn-runtime-ubuntu22.04
4
 
5
  # CUDA libs present + on loader path
@@ -12,13 +11,10 @@ RUN ln -sf /usr/local/cuda/targets/x86_64-linux/lib /usr/local/cuda/lib64 || tru
12
  RUN set -eux; \
13
  apt-get update && apt-get install -y --no-install-recommends gnupg ca-certificates curl; \
14
  install -d -m 0755 /usr/share/keyrings; \
15
- # Refresh the *same* keyring the base source uses (no second source file)
16
  curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub \
17
  | gpg --batch --yes --dearmor -o /usr/share/keyrings/cuda-archive-keyring.gpg; \
18
  apt-get update; \
19
- # If libcudnn is "held", unhold it so we can move to 9.8
20
  apt-mark unhold libcudnn9-cuda-12 || true; \
21
- # Install cuDNN 9.8 for CUDA 12 (correct dev package name!)
22
  apt-get install -y --no-install-recommends \
23
  'libcudnn9-cuda-12=9.8.*' \
24
  'libcudnn9-dev-cuda-12=9.8.*' \
@@ -27,7 +23,7 @@ RUN set -eux; \
27
  ldconfig; \
28
  rm -rf /var/lib/apt/lists/*
29
 
30
- # (optional) preload workaround if still needed
31
  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
32
 
33
  # Better allocator (less fragmentation than BFC during XLA autotune)
@@ -44,7 +40,7 @@ ENV DEBIAN_FRONTEND=noninteractive \
44
 
45
  ENV JAX_PLATFORMS=""
46
 
47
- # --- OS deps ---
48
  RUN apt-get update && apt-get install -y --no-install-recommends \
49
  software-properties-common curl ca-certificates git \
50
  libsndfile1 ffmpeg \
@@ -57,7 +53,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
57
  # Make python3 => 3.11 for convenience
58
  RUN ln -sf /usr/bin/python3.11 /usr/bin/python && python -m pip install --upgrade pip
59
 
60
- # --- Python deps (pin order matters!) ---
 
61
  # 1) Install JAX first
62
  RUN python -m pip install "jax[cuda12]==0.7.1" "jaxlib==0.7.1"
63
 
@@ -95,60 +92,30 @@ RUN python -m pip install --no-deps \
95
  RUN python -m pip install --no-deps \
96
  'git+https://github.com/magenta/magenta-realtime#egg=magenta_rt[gpu]'
97
 
98
- # 10) Verify TensorFlow installation
99
- RUN python -c "import tensorflow as tf; print('='*50); print('TensorFlow version:', tf.__version__); print('='*50)"
100
-
101
- RUN python -m pip install cached-property
102
-
103
- RUN python -c "import tensorflow as tf; print('='*50); print('FINAL 3TensorFlow version:', tf.__version__); print('='*50)"
104
-
105
- RUN python -m pip install 'git+https://github.com/google/airio.git@main'
106
-
107
- RUN python -c "import tensorflow as tf; print('='*50); print('FINAL 4TensorFlow version:', tf.__version__); print('='*50)"
108
- # 6) t5x/flaxformer with --no-deps
109
- RUN python -m pip install --no-deps \
110
- "t5x @ git+https://github.com/google-research/t5x.git@92c5b46" \
111
- "flaxformer @ git+https://github.com/google/flaxformer@399ea3a"
112
- RUN python -c "import tensorflow as tf; print('='*50); print('FINAL 5TensorFlow version:', tf.__version__); print('='*50)"
113
- # 7) magenta-rt last with --no-deps
114
- RUN python -m pip install --no-deps \
115
- 'git+https://github.com/magenta/magenta-realtime#egg=magenta_rt[gpu]'
116
 
117
- # 8) Verify final TensorFlow version
118
- RUN python -c "import tensorflow as tf; print('='*50); print('FINAL 6TensorFlow version:', tf.__version__); print('='*50)"
119
 
120
- RUN python -m pip install huggingface_hub
121
-
122
-
123
- RUN python -m pip install gradio
124
-
125
- RUN python -m pip install soxr
126
 
127
- # Switch to Spaces’ preferred user
128
- # Switch to Spaces’ preferred user
129
  RUN useradd -m -u 1000 appuser
130
  WORKDIR /home/appuser/app
131
 
132
- # Copy from *build context* into image, owned by appuser
133
  COPY --chown=appuser:appuser app.py /home/appuser/app/app.py
134
-
135
- # NEW: shared utils + worker
136
  COPY --chown=appuser:appuser utils.py /home/appuser/app/utils.py
137
  COPY --chown=appuser:appuser jam_worker.py /home/appuser/app/jam_worker.py
138
-
139
  COPY --chown=appuser:appuser one_shot_generation.py /home/appuser/app/one_shot_generation.py
140
-
141
  COPY --chown=appuser:appuser model_management.py /home/appuser/app/model_management.py
142
-
143
  COPY --chown=appuser:appuser documentation.html /home/appuser/app/documentation.html
144
-
145
  COPY --chown=appuser:appuser lil_demo_540p.mp4 /home/appuser/app/lil_demo_540p.mp4
146
-
147
  COPY --chown=appuser:appuser magentaRT_rt_tester.html /home/appuser/app/magentaRT_rt_tester.html
148
-
149
  COPY --chown=appuser:appuser magenta_prompts.js /home/appuser/app/magenta_prompts.js
150
-
151
- # Create docs directory and copy documentation files
152
  COPY --chown=appuser:appuser docs/ /home/appuser/app/docs/
153
 
154
  USER appuser
 
1
+ # thecollabagepatch/magenta:latest - optimized
 
2
  FROM nvidia/cuda:12.6.2-cudnn-runtime-ubuntu22.04
3
 
4
  # CUDA libs present + on loader path
 
11
  RUN set -eux; \
12
  apt-get update && apt-get install -y --no-install-recommends gnupg ca-certificates curl; \
13
  install -d -m 0755 /usr/share/keyrings; \
 
14
  curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub \
15
  | gpg --batch --yes --dearmor -o /usr/share/keyrings/cuda-archive-keyring.gpg; \
16
  apt-get update; \
 
17
  apt-mark unhold libcudnn9-cuda-12 || true; \
 
18
  apt-get install -y --no-install-recommends \
19
  'libcudnn9-cuda-12=9.8.*' \
20
  'libcudnn9-dev-cuda-12=9.8.*' \
 
23
  ldconfig; \
24
  rm -rf /var/lib/apt/lists/*
25
 
26
+ # Optional preload workaround if still needed
27
  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
28
 
29
  # Better allocator (less fragmentation than BFC during XLA autotune)
 
40
 
41
  ENV JAX_PLATFORMS=""
42
 
43
+ # --- OS dependencies ---
44
  RUN apt-get update && apt-get install -y --no-install-recommends \
45
  software-properties-common curl ca-certificates git \
46
  libsndfile1 ffmpeg \
 
53
  # Make python3 => 3.11 for convenience
54
  RUN ln -sf /usr/bin/python3.11 /usr/bin/python && python -m pip install --upgrade pip
55
 
56
+ # --- Python dependencies (install order matters!) ---
57
+
58
  # 1) Install JAX first
59
  RUN python -m pip install "jax[cuda12]==0.7.1" "jaxlib==0.7.1"
60
 
 
92
  RUN python -m pip install --no-deps \
93
  'git+https://github.com/magenta/magenta-realtime#egg=magenta_rt[gpu]'
94
 
95
+ # 10) Upgrade to latest versions to support XlaCallModule v10
96
+ RUN python -m pip install --upgrade --force-reinstall \
97
+ tf-nightly
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
 
99
+ # Also upgrade JAX to latest to ensure XLA compatibility
100
+ RUN python -m pip install --upgrade "jax[cuda12]" jaxlib
101
 
102
+ # 11) Verify TensorFlow installation
103
+ RUN python -c "import tensorflow as tf; print('='*50); print('TensorFlow version:', tf.__version__); print('='*50)"
 
 
 
 
104
 
105
+ # Switch to non-root user for security
 
106
  RUN useradd -m -u 1000 appuser
107
  WORKDIR /home/appuser/app
108
 
109
+ # Copy application files
110
  COPY --chown=appuser:appuser app.py /home/appuser/app/app.py
 
 
111
  COPY --chown=appuser:appuser utils.py /home/appuser/app/utils.py
112
  COPY --chown=appuser:appuser jam_worker.py /home/appuser/app/jam_worker.py
 
113
  COPY --chown=appuser:appuser one_shot_generation.py /home/appuser/app/one_shot_generation.py
 
114
  COPY --chown=appuser:appuser model_management.py /home/appuser/app/model_management.py
 
115
  COPY --chown=appuser:appuser documentation.html /home/appuser/app/documentation.html
 
116
  COPY --chown=appuser:appuser lil_demo_540p.mp4 /home/appuser/app/lil_demo_540p.mp4
 
117
  COPY --chown=appuser:appuser magentaRT_rt_tester.html /home/appuser/app/magentaRT_rt_tester.html
 
118
  COPY --chown=appuser:appuser magenta_prompts.js /home/appuser/app/magenta_prompts.js
 
 
119
  COPY --chown=appuser:appuser docs/ /home/appuser/app/docs/
120
 
121
  USER appuser