@@ -4,9 +4,27 @@ RUN microdnf update -y && \
4
4
python-pip python-devel && \
5
5
pip install --upgrade --no-cache-dir pip wheel && \
6
6
microdnf clean all
7
- RUN pip install --no-cache-dir torch
8
7
9
- # FROM icr.io/fm-stack/ubi9-minimal-py39-torch as builder
8
+ ARG TARGETARCH
9
+ ENV TORCH_VERSION=2.7.1
10
+ ARG _GLIBCXX_USE_CXX11_ABI=1
11
+
12
+ RUN if [ "$TARGETARCH" = "s390x" ]; then \
13
+ microdnf install -y git gcc-toolset-13 make wget unzip rust cargo gcc-gfortran python3-devel openblas-devel pkgconfig && \
14
+ microdnf clean all && \
15
+ pip install --upgrade pip cmake setuptools wheel && \
16
+ source /opt/rh/gcc-toolset-13/enable && \
17
+ git clone --recursive https://github.com/pytorch/pytorch.git -b v${TORCH_VERSION} && \
18
+ cd pytorch && pip install -r requirements.txt && \
19
+ python setup.py develop && \
20
+ rm -f dist/torch*+git*whl && \
21
+ PYTORCH_BUILD_VERSION=${TORCH_VERSION} PYTORCH_BUILD_NUMBER=1 pip wheel . --wheel-dir /torchwheels/ && \
22
+ pip install /torchwheels/*.whl; \
23
+ else \
24
+ pip install --no-cache-dir torch; \
25
+ fi
26
+
27
+
10
28
FROM base as builder
11
29
12
30
COPY ./common/requirements.txt .
@@ -15,6 +33,11 @@ RUN pip install --no-cache-dir -r requirements.txt
15
33
COPY ./huggingface/requirements.txt .
16
34
RUN pip install --no-cache-dir -r requirements.txt
17
35
36
+ RUN if [ "$TARGETARCH" = "s390x" ]; then \
37
+ pip install --no-cache-dir uvicorn; \
38
+ fi
39
+
40
+
18
41
FROM builder
19
42
20
43
WORKDIR /app
0 commit comments