File size: 1,135 Bytes
ad2551a
 
 
7a18c1b
 
ad2551a
 
7a18c1b
 
 
 
 
 
 
 
 
 
ad2551a
7a18c1b
 
ad2551a
 
 
 
7a18c1b
 
ad2551a
 
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
FROM pytorch/pytorch:2.4.0-cuda12.1-cudnn9-runtime

WORKDIR /app

# System deps
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*

# Pre-baked ai-toolkit (numpy 2.5 / dctorch / torchdiffeq / torchsde / clip forks, 3.14-compatible)
# Copied from local checkout so HF doesn't have to clone the submodule / run pip install -e .
COPY ai-toolkit /app/ai-toolkit

# Make ai-toolkit importable. Upstream ai-toolkit ships without setup.py / pyproject.toml,
# so pip install -e . would fail. We add it to PYTHONPATH instead.
ENV PYTHONPATH=/app:/app/ai-toolkit
ENV PYTHONUNBUFFERED=1
ENV HF_HOME=/app/hf_cache
ENV TRANSFORMERS_CACHE=/app/hf_cache

# Install runtime deps
RUN pip install --no-cache-dir huggingface_hub hf_transfer

# Copy training files
COPY . /app/

# Pre-download FLUX base + training adapter at build time so they're in the image cache
RUN python -c "import os; os.environ['HF_HUB_ENABLE_HF_TRANSFER']='1'; from huggingface_hub import snapshot_download; snapshot_download('Niansuh/FLUX.1-schnell'); snapshot_download('ostris/FLUX.1-schnell-training-adapter')"

CMD ["python", "/app/train_cloud.py"]