Spaces:
Sleeping
Sleeping
File size: 1,745 Bytes
e6af059 00be865 e6af059 00be865 52b4f50 e6af059 52b4f50 e6af059 00be865 e6af059 d1010a9 e6af059 00be865 5bb488e 52b4f50 00be865 5bb488e e6af059 f2322cb 02c2ba2 e6af059 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | FROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-devel
# System deps
# - libcairo2 is required by cairosvg
# - ninja-build / build-essential are commonly needed for compiling flash-attn
# - libaio-dev and the CUDA compiler are required by some training/inference deps
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
build-essential \
ninja-build \
pkg-config \
libcairo2 \
libcairo2-dev \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
libaio-dev \
cuda-compiler-12-4 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Cache buster - change this to force rebuild
ENV CACHE_BUST=2026-02-27-06-46
# Install StarVector from GitHub
# Pin to main branch by default; you can pin a commit for reproducibility.
RUN git clone --depth 1 https://github.com/joanrod/star-vector.git /app/star-vector
# Install python dependencies
# The upstream package depends on flash_attn, which tries to import torch during build.
# Disable build isolation so torch from the base image is visible.
ENV PIP_NO_BUILD_ISOLATION=1
# Install dependencies - don't upgrade setuptools to avoid breaking pkg_resources
RUN pip install --upgrade pip wheel \
# pycairo (pulled in via svglib/rlpycairo) uses meson-python as its PEP517 backend
&& pip install meson meson-python \
&& pip install flash-attn==2.7.3 --no-build-isolation \
&& pip install -e /app/star-vector --no-build-isolation
# Force cache invalidation - update this timestamp to rebuild
RUN echo "Build timestamp: 2026-02-27 06:14:00"
# Copy Space app (updated with torch_dtype fix)
COPY app.py /app/app.py
# Hugging Face Spaces sets PORT; default to 7860 locally.
ENV PORT=7860
EXPOSE 7860
CMD ["python", "/app/app.py"]
|