Spaces:
Sleeping
Sleeping
udbhav
commited on
Commit
Β·
10d49cc
1
Parent(s):
aa63a6a
added trame reqs
Browse files- Dockerfile +17 -18
- app.py +4 -10
- requirements.txt +51 -18
Dockerfile
CHANGED
|
@@ -1,27 +1,28 @@
|
|
| 1 |
-
|
| 2 |
# Use NVIDIA CUDA base image (Ubuntu 22.04 jammy)
|
| 3 |
FROM nvidia/cuda:12.3.2-devel-ubuntu22.04
|
| 4 |
|
| 5 |
-
#
|
| 6 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 7 |
ENV PYTHONUNBUFFERED=1
|
| 8 |
ENV CUDA_HOME=/usr/local/cuda
|
| 9 |
ENV PATH=${CUDA_HOME}/bin:/usr/local/bin:${PATH}
|
| 10 |
ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
#
|
| 16 |
-
# ENV
|
| 17 |
|
| 18 |
-
# System deps +
|
| 19 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 20 |
software-properties-common \
|
| 21 |
ca-certificates \
|
| 22 |
curl wget git build-essential \
|
| 23 |
libgl1-mesa-glx libglib2.0-0 libsm6 libxext6 libxrender1 \
|
| 24 |
libgomp1 libgcc-s1 \
|
|
|
|
|
|
|
| 25 |
&& add-apt-repository ppa:deadsnakes/ppa -y \
|
| 26 |
&& apt-get update && apt-get install -y --no-install-recommends \
|
| 27 |
python3.12 python3.12-dev python3.12-venv \
|
|
@@ -32,7 +33,7 @@ RUN curl -sS https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py \
|
|
| 32 |
&& python3.12 /tmp/get-pip.py \
|
| 33 |
&& rm /tmp/get-pip.py
|
| 34 |
|
| 35 |
-
# Make 'python' and 'pip' point to 3.12
|
| 36 |
RUN ln -sf /usr/bin/python3.12 /usr/bin/python && \
|
| 37 |
ln -sf /usr/local/bin/pip3.12 /usr/local/bin/pip
|
| 38 |
|
|
@@ -41,7 +42,7 @@ ENV APP_DATA_DIR=/data
|
|
| 41 |
ENV HF_HOME=/data/hf_home
|
| 42 |
ENV HUGGINGFACE_HUB_CACHE=/data/hf_home
|
| 43 |
ENV TRANSFORMERS_CACHE=/data/hf_home
|
| 44 |
-
ENV MPLCONFIGDIR=/data/matplotlib
|
| 45 |
|
| 46 |
RUN mkdir -p /data/geometry /data/solution /data/weights /data/hf_home /data/matplotlib \
|
| 47 |
&& chmod -R 777 /data
|
|
@@ -61,19 +62,17 @@ COPY requirements.txt .
|
|
| 61 |
RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
|
| 62 |
&& pip install --no-cache-dir -r requirements.txt
|
| 63 |
|
| 64 |
-
# Copy the rest of the source
|
| 65 |
COPY . .
|
| 66 |
|
| 67 |
-
# Create cache directory for downloaded repos
|
| 68 |
-
RUN mkdir -p /app/cache && chmod 777 /app/cache
|
| 69 |
-
|
| 70 |
# Permissions
|
| 71 |
RUN chmod +x app.py
|
| 72 |
RUN chown -R 1000:1000 /app
|
| 73 |
|
| 74 |
-
# Expose Gradio port
|
| 75 |
EXPOSE 7860
|
| 76 |
|
| 77 |
-
# Run app
|
| 78 |
-
CMD ["python", "app.py"]
|
| 79 |
-
|
|
|
|
|
|
|
|
|
| 1 |
# Use NVIDIA CUDA base image (Ubuntu 22.04 jammy)
|
| 2 |
FROM nvidia/cuda:12.3.2-devel-ubuntu22.04
|
| 3 |
|
| 4 |
+
# ---------------- Base env ----------------
|
| 5 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
ENV PYTHONUNBUFFERED=1
|
| 7 |
ENV CUDA_HOME=/usr/local/cuda
|
| 8 |
ENV PATH=${CUDA_HOME}/bin:/usr/local/bin:${PATH}
|
| 9 |
ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
|
| 10 |
|
| 11 |
+
# Fix OpenMP threads to a valid integer (libgomp warning)
|
| 12 |
+
ENV OMP_NUM_THREADS=4
|
| 13 |
+
|
| 14 |
+
# Force headless: never try X11 DISPLAY
|
| 15 |
+
# ENV DISPLAY=""
|
| 16 |
|
| 17 |
+
# ---------------- System deps + Python 3.12 + headless GL ----------------
|
| 18 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 19 |
software-properties-common \
|
| 20 |
ca-certificates \
|
| 21 |
curl wget git build-essential \
|
| 22 |
libgl1-mesa-glx libglib2.0-0 libsm6 libxext6 libxrender1 \
|
| 23 |
libgomp1 libgcc-s1 \
|
| 24 |
+
libosmesa6 libosmesa6-dev \
|
| 25 |
+
libegl1-mesa libegl1-mesa-dev \
|
| 26 |
&& add-apt-repository ppa:deadsnakes/ppa -y \
|
| 27 |
&& apt-get update && apt-get install -y --no-install-recommends \
|
| 28 |
python3.12 python3.12-dev python3.12-venv \
|
|
|
|
| 33 |
&& python3.12 /tmp/get-pip.py \
|
| 34 |
&& rm /tmp/get-pip.py
|
| 35 |
|
| 36 |
+
# Make 'python' and 'pip' point to Python 3.12
|
| 37 |
RUN ln -sf /usr/bin/python3.12 /usr/bin/python && \
|
| 38 |
ln -sf /usr/local/bin/pip3.12 /usr/local/bin/pip
|
| 39 |
|
|
|
|
| 42 |
ENV HF_HOME=/data/hf_home
|
| 43 |
ENV HUGGINGFACE_HUB_CACHE=/data/hf_home
|
| 44 |
ENV TRANSFORMERS_CACHE=/data/hf_home
|
| 45 |
+
ENV MPLCONFIGDIR=/data/matplotlib
|
| 46 |
|
| 47 |
RUN mkdir -p /data/geometry /data/solution /data/weights /data/hf_home /data/matplotlib \
|
| 48 |
&& chmod -R 777 /data
|
|
|
|
| 62 |
RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
|
| 63 |
&& pip install --no-cache-dir -r requirements.txt
|
| 64 |
|
| 65 |
+
# Copy the rest of the source code
|
| 66 |
COPY . .
|
| 67 |
|
|
|
|
|
|
|
|
|
|
| 68 |
# Permissions
|
| 69 |
RUN chmod +x app.py
|
| 70 |
RUN chown -R 1000:1000 /app
|
| 71 |
|
| 72 |
+
# Expose Trame/Gradio port
|
| 73 |
EXPOSE 7860
|
| 74 |
|
| 75 |
+
# Run app (Trame or Gradio, same entrypoint)
|
| 76 |
+
# CMD ["python", "app.py"]
|
| 77 |
+
# Run app on 0.0.0.0 so HF proxy can reach it
|
| 78 |
+
CMD python app.py --host 0.0.0.0 --port ${PORT:-7860} --server
|
app.py
CHANGED
|
@@ -6,12 +6,6 @@ import tempfile
|
|
| 6 |
from pathlib import Path
|
| 7 |
import traceback
|
| 8 |
|
| 9 |
-
# Proxy support (office networks often require this)
|
| 10 |
-
# proxy = os.environ.get("HTTP_PROXY") or os.environ.get("http_proxy")
|
| 11 |
-
# if proxy:
|
| 12 |
-
# print(f"π Using proxy: {proxy}")
|
| 13 |
-
# else:
|
| 14 |
-
# print("π No proxy detected, connecting directly")
|
| 15 |
|
| 16 |
# Writable base dir
|
| 17 |
DATA_DIR = os.environ.get("APP_DATA_DIR", os.path.join(tempfile.gettempdir(), "appdata"))
|
|
@@ -52,15 +46,15 @@ def download_private_repo(cache_dir, repo_id, hf_token):
|
|
| 52 |
continue
|
| 53 |
|
| 54 |
if os.path.isdir(src_path):
|
| 55 |
-
print(f"π Copying directory: {item}")
|
| 56 |
if os.path.exists(dst_path):
|
| 57 |
shutil.rmtree(dst_path)
|
| 58 |
shutil.copytree(src_path, dst_path)
|
| 59 |
-
print(f"β
Directory {item} copied successfully")
|
| 60 |
elif os.path.isfile(src_path):
|
| 61 |
-
print(f"π Copying file: {item}")
|
| 62 |
shutil.copy2(src_path, dst_path)
|
| 63 |
-
print(f"β
File {item} copied successfully")
|
| 64 |
|
| 65 |
print(f"π All repository contents copied to current working directory")
|
| 66 |
|
|
|
|
| 6 |
from pathlib import Path
|
| 7 |
import traceback
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
# Writable base dir
|
| 11 |
DATA_DIR = os.environ.get("APP_DATA_DIR", os.path.join(tempfile.gettempdir(), "appdata"))
|
|
|
|
| 46 |
continue
|
| 47 |
|
| 48 |
if os.path.isdir(src_path):
|
| 49 |
+
# print(f"π Copying directory: {item}")
|
| 50 |
if os.path.exists(dst_path):
|
| 51 |
shutil.rmtree(dst_path)
|
| 52 |
shutil.copytree(src_path, dst_path)
|
| 53 |
+
# print(f"β
Directory {item} copied successfully")
|
| 54 |
elif os.path.isfile(src_path):
|
| 55 |
+
# print(f"π Copying file: {item}")
|
| 56 |
shutil.copy2(src_path, dst_path)
|
| 57 |
+
# print(f"β
File {item} copied successfully")
|
| 58 |
|
| 59 |
print(f"π All repository contents copied to current working directory")
|
| 60 |
|
requirements.txt
CHANGED
|
@@ -1,42 +1,75 @@
|
|
| 1 |
-
|
| 2 |
-
huggingface_hub>=0.16.0
|
| 3 |
--index-url https://download.pytorch.org/whl/cu121
|
| 4 |
--extra-index-url https://pypi.org/simple
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
| 11 |
|
| 12 |
-f https://data.pyg.org/whl/torch-2.5.0+cu121.html
|
|
|
|
| 13 |
pyg_lib
|
| 14 |
torch_scatter
|
| 15 |
torch_sparse
|
| 16 |
torch_cluster
|
| 17 |
torch_spline_conv
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
matplotlib
|
| 20 |
-
vtk
|
| 21 |
-
timm
|
| 22 |
-
einops
|
| 23 |
seaborn
|
| 24 |
-
pyvista
|
| 25 |
imageio
|
| 26 |
-
pandas
|
| 27 |
meshio
|
| 28 |
-
|
| 29 |
-
omegaconf
|
| 30 |
tensorboard
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
lion-pytorch
|
| 32 |
-
scikit-learn
|
| 33 |
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
pathlib2>=2.3.0
|
| 36 |
typing-extensions>=4.0.0
|
| 37 |
transformers>=4.20.0
|
| 38 |
trimesh
|
| 39 |
-
gradio_client==1.12.1
|
| 40 |
pytest
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
| 1 |
--index-url https://download.pytorch.org/whl/cu121
|
| 2 |
--extra-index-url https://pypi.org/simple
|
| 3 |
|
| 4 |
+
##############################
|
| 5 |
+
# Core ML stack (CUDA build) #
|
| 6 |
+
##############################
|
| 7 |
|
| 8 |
+
torch==2.5.0
|
| 9 |
+
torchvision==0.20.0
|
| 10 |
+
torchaudio==2.5.0
|
| 11 |
|
| 12 |
-f https://data.pyg.org/whl/torch-2.5.0+cu121.html
|
| 13 |
+
torch_geometric
|
| 14 |
pyg_lib
|
| 15 |
torch_scatter
|
| 16 |
torch_sparse
|
| 17 |
torch_cluster
|
| 18 |
torch_spline_conv
|
| 19 |
|
| 20 |
+
#########################
|
| 21 |
+
# Numerics / science #
|
| 22 |
+
#########################
|
| 23 |
+
|
| 24 |
+
numpy
|
| 25 |
+
scipy
|
| 26 |
+
pandas
|
| 27 |
+
scikit-learn
|
| 28 |
+
|
| 29 |
+
#########################
|
| 30 |
+
# Plotting & misc #
|
| 31 |
+
#########################
|
| 32 |
+
|
| 33 |
matplotlib
|
|
|
|
|
|
|
|
|
|
| 34 |
seaborn
|
|
|
|
| 35 |
imageio
|
|
|
|
| 36 |
meshio
|
| 37 |
+
h5py
|
|
|
|
| 38 |
tensorboard
|
| 39 |
+
|
| 40 |
+
#########################
|
| 41 |
+
# Model / config helpers#
|
| 42 |
+
#########################
|
| 43 |
+
|
| 44 |
+
timm
|
| 45 |
+
einops
|
| 46 |
+
omegaconf
|
| 47 |
+
accelerate
|
| 48 |
+
huggingface-hub
|
| 49 |
lion-pytorch
|
|
|
|
| 50 |
|
| 51 |
+
#########################
|
| 52 |
+
# 3D / VTK / Trame stack#
|
| 53 |
+
#########################
|
| 54 |
+
|
| 55 |
+
vtk
|
| 56 |
+
pyvista
|
| 57 |
+
|
| 58 |
+
trame==3.12.0
|
| 59 |
+
trame-vtk==2.10.0
|
| 60 |
+
trame-vuetify==3.1.0
|
| 61 |
+
trame-server==3.6.2
|
| 62 |
+
trame-client==3.10.4
|
| 63 |
+
wslink
|
| 64 |
+
|
| 65 |
+
#########################
|
| 66 |
+
# Web / misc #
|
| 67 |
+
#########################
|
| 68 |
+
|
| 69 |
pathlib2>=2.3.0
|
| 70 |
typing-extensions>=4.0.0
|
| 71 |
transformers>=4.20.0
|
| 72 |
trimesh
|
|
|
|
| 73 |
pytest
|
| 74 |
+
requests
|
| 75 |
+
PyYAML
|