Skip to content

Commit d8a50e6

Browse files
committed
Fixing HPU with manual overrides.
1 parent 16511a1 commit d8a50e6

File tree

3 files changed

+63
-178
lines changed

3 files changed

+63
-178
lines changed

Dockerfile-intel

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,17 @@ COPY backends backends
9696
COPY backends/python/server/text_embeddings_server/models/__init__.py backends/python/server/text_embeddings_server/models/__init__.py
9797
COPY backends/python/server/pyproject.toml backends/python/server/pyproject.toml
9898

99+
# Re-override some deps uv cannot handle them because they are
100+
# git compiled versions.
101+
# uninstall torchvision because sentence-transformers forces the reinstall
102+
# which would crash transformers
99103
RUN cd backends/python/server && \
100104
pip install -U pip uv && \
101105
uv venv && \
102106
cp -r /usr/local/lib/python3.10/dist-packages/* /usr/src/backends/python/server/.venv/lib/python3.10/site-packages/ && \
103-
make install-hpu
107+
make install-hpu && \
108+
cp -r /usr/local/lib/python3.10/dist-packages/torch /usr/src/backends/python/server/.venv/lib/python3.10/site-packages/ && \
109+
uv pip uninstall torchvision
104110

105111
FROM intel/intel-extension-for-pytorch:2.6.10-xpu AS xpu
106112

backends/python/server/pyproject.toml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,31 @@ conflicts = [
5555
override-dependencies = [
5656
"intel-sycl-rt==2025.0.4; extra == 'xpu'",
5757
"intel-openmp==2025.0.4; extra == 'xpu'",
58+
# Prebuilt on hpu container
59+
"numpy<2.0; extra == 'xpu'",
60+
# torch on hpu is installed from the docker image
61+
# which has a git tag handle, and cannot be seen
62+
# by uv therefore by the lock.
63+
# This line should force uv to ignore installing torch, but it doesn't
64+
# seem to work. Therefore there is still an override within Dockerfile-intel
65+
# More info: https://github.com/astral-sh/uv/issues/9174
66+
# "torch; sys_platform == 'never' and extra == 'hpu'",
5867
]
5968
constraint-dependencies = [
6069
"torch==2.5.1; extra == 'hpu'",
70+
"numpy<2.0; extra == 'xpu'",
6171
"torch==2.6.0; extra == 'cpu'",
6272
"torch==2.6.0; extra == 'gpu'",
6373
"torch==2.6.0+xpu; extra == 'xpu'",
64-
# "torch; extra == 'hpu'",
6574
]
6675

6776
[tool.uv.sources]
6877
torch = [
6978
{ index = "torch-cpu", extra = "cpu" },
7079
{ index = "torch-gpu", extra = "gpu" },
7180
{ index = "torch-xpu", extra = "xpu" },
81+
# Add a proper index when available
82+
# { index = "torch-cpu", extra = "hpu" },
7283
]
7384
intel-extension-for-pytorch = [ {index = "xpu" }]
7485
oneccl_bind_pt = [ {index = "xpu" }]

0 commit comments

Comments
 (0)