@@ -84,16 +84,40 @@ RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \
84
84
rustup default stable && \
85
85
rustup show
86
86
87
+ FROM python-install AS torch
88
+ ARG TORCH_VERSION=2.7.0
89
+ ENV export _GLIBCXX_USE_CXX11_ABI=1
90
+ ENV CARGO_HOME=/root/.cargo
91
+ ENV RUSTUP_HOME=/root/.rustup
92
+ ENV PATH="$CARGO_HOME/bin:$RUSTUP_HOME/bin:$PATH"
93
+
94
+ WORKDIR /tmp
95
+
96
+ RUN --mount=type=cache,target=/root/.cache/uv \
97
+ --mount=type=bind,from=rust,source=/root/.cargo,target=/root/.cargo,rw \
98
+ --mount=type=bind,from=rust,source=/root/.rustup,target=/root/.rustup,rw \
99
+ git clone https://github.com/pytorch/pytorch.git && \
100
+ cd pytorch && \
101
+ git checkout v2.7.0 && \
102
+ git submodule sync && \
103
+ git submodule update --init --recursive && \
104
+ uv pip install cmake ninja && \
105
+ uv pip install -r requirements.txt && \
106
+ python setup.py bdist_wheel
107
+
108
+
87
109
FROM python-install AS torch-vision
88
110
# Install torchvision
89
- ARG TORCH_VERSION=2.7.0.dev20250304
111
+ ARG TORCH_VERSION=2.7.0
90
112
ARG TORCH_VISION_VERSION=v0.20.1
91
113
WORKDIR /tmp
92
114
RUN --mount=type=cache,target=/root/.cache/uv \
115
+ --mount=type=bind,from=torch,source=/tmp/pytorch/dist,target=/tmp/torch-wheels/ \
93
116
git clone https://github.com/pytorch/vision.git && \
94
117
cd vision && \
95
118
git checkout $TORCH_VISION_VERSION && \
96
- uv pip install -v torch==${TORCH_VERSION} --extra-index-url https://download.pytorch.org/whl/nightly/cpu && \
119
+ TORCH_WHL_FILE=$(ls /tmp/torch-wheels/*.whl | head -n 1) && \
120
+ uv pip install -v $TORCH_WHL_FILE && \
97
121
python setup.py bdist_wheel
98
122
99
123
FROM python-install AS hf-xet-builder
@@ -137,15 +161,17 @@ RUN --mount=type=cache,target=/root/.cache/uv \
137
161
--mount=type=bind,from=pyarrow,source=/tmp/arrow/python/dist,target=/tmp/arrow-wheels \
138
162
--mount=type=bind,from=torch-vision,source=/tmp/vision/dist,target=/tmp/vision-wheels/ \
139
163
--mount=type=bind,from=hf-xet-builder,source=/tmp/hf-xet/dist,target=/tmp/hf-xet-wheels/ \
164
+ --mount=type=bind,from=torch,source=/tmp/pytorch/dist,target=/tmp/torch-wheels/ \
140
165
sed -i '/^torch/d' requirements/build.txt && \
141
166
ARROW_WHL_FILE=$(ls /tmp/arrow-wheels/pyarrow-*.whl | head -n 1) && \
142
167
VISION_WHL_FILE=$(ls /tmp/vision-wheels/*.whl | head -n 1) && \
143
168
HF_XET_WHL_FILE=$(ls /tmp/hf-xet-wheels/*.whl | head -n 1) && \
169
+ TORCH_WHL_FILE=$(ls /tmp/torch-wheels/*.whl | head -n 1) && \
144
170
uv pip install -v \
145
171
$ARROW_WHL_FILE \
146
172
$VISION_WHL_FILE \
147
173
$HF_XET_WHL_FILE \
148
- --extra-index-url https://download.pytorch.org/whl/nightly/cpu \
174
+ $TORCH_WHL_FILE \
149
175
--index-strategy unsafe-best-match \
150
176
-r requirements/build.txt \
151
177
-r requirements/cpu.txt
0 commit comments