File size: 2,993 Bytes
a46f204
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
56
57
# xv01-train: training image for xevyo-01 (LoRA on Qwen/Qwen3.5-9B).
#
#   docker build -t xv01-train:latest /data/xevyo-01/code/train
#
# Base: official PyTorch image, torch 2.10 (same torch as the vLLM 0.17 image we
# serve with), CUDA 12.8, devel variant so causal-conv1d can compile for sm90 if
# its prebuilt wheel is ever unavailable.
FROM pytorch/pytorch:2.10.0-cuda12.8-cudnn9-devel

# PIP_BREAK_SYSTEM_PACKAGES: this base image installs torch into the system
# Python 3.12 (/usr/local/lib/python3.12/dist-packages), which Ubuntu marks as
# externally managed (PEP 668). Overriding that is safe inside a single-purpose
# image and keeps the base image's torch build.
ENV PIP_NO_CACHE_DIR=1 \
    PIP_BREAK_SYSTEM_PACKAGES=1 \
    PIP_DISABLE_PIP_VERSION_CHECK=1 \
    PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    TORCH_CUDA_ARCH_LIST="9.0" \
    MAX_JOBS=16 \
    HF_HOME=/data/xevyo-01/hf \
    HF_HUB_OFFLINE=1 \
    TOKENIZERS_PARALLELISM=false

# Freeze torch/triton exactly as the base image ships them, so no requirement
# below can pull a different torch build.
RUN python -c "import importlib.metadata as m; print('\n'.join(f'{p}=={m.version(p)}' for p in ('torch','triton')))" > /opt/constraints.txt \
 && cat /opt/constraints.txt

COPY requirements.txt /opt/xv01/requirements.txt
RUN pip install -c /opt/constraints.txt -r /opt/xv01/requirements.txt

# causal-conv1d's setup.py downloads the matching prebuilt wheel
# (cu12 / torch 2.10 / cxx11abi) and falls back to compiling; it needs torch
# importable at build time, hence --no-build-isolation.
RUN pip install -c /opt/constraints.txt --no-build-isolation causal-conv1d==1.7.0

# Triton 3.7.1, on purpose newer than the 3.6.0 that torch 2.10 pins.
# flash-linear-attention refuses to run the Gated DeltaNet backward kernel
# (chunk_bwd_dqkwg) on Hopper GPUs (H100) with Triton >= 3.4.0 and < 3.7.1,
# because those versions compile it to wrong gradients (fla issue #640). The first
# smoke run on 2026-11-13 died on exactly that error. pip prints a "torch requires
# triton==3.6.0" warning here; that pin only matters for torch.compile, which the
# training code does not use. Installed last and without the constraints file.
RUN pip install triton==3.7.1

# Fail the build if the stack does not import, and print the versions.
RUN python -c "import torch, transformers, peft, trl, accelerate, datasets, fla, causal_conv1d; \
print('torch', torch.__version__, 'cuda', torch.version.cuda); \
print('transformers', transformers.__version__, 'peft', peft.__version__, 'trl', trl.__version__); \
print('accelerate', accelerate.__version__, 'datasets', datasets.__version__, 'fla', fla.__version__); \
import triton; print('triton', triton.__version__); assert tuple(int(x) for x in triton.__version__.split('.')[:3]) >= (3, 7, 1); \
from transformers import Qwen3_5ForConditionalGeneration, Qwen3_5ForCausalLM; print('qwen3_5 classes ok')" \
 && pip freeze > /opt/xv01/pip-freeze.txt

WORKDIR /data/xevyo-01/code