Morgan Funtowicz commited on
Commit
6c0e598
·
1 Parent(s): 5e1abf0

misc(embeddings): ad missing deps to requirements.txt

Browse files
Files changed (2) hide show
  1. Dockerfile +10 -0
  2. requirements.txt +1 -0
Dockerfile CHANGED
@@ -2,6 +2,8 @@ ARG SDK_VERSION=latest
2
  FROM huggingface/hfendpoints-sdk:${SDK_VERSION} AS sdk
3
 
4
  FROM python:3.12-bookworm
 
 
5
  RUN --mount=type=bind,from=sdk,source=/opt/hfendpoints/dist,target=/usr/local/endpoints/dist \
6
  --mount=type=bind,source=requirements.txt,target=/tmp/requirements.txt \
7
  python3 -m pip install torch --index-url https://download.pytorch.org/whl/cpu && \
@@ -10,9 +12,17 @@ RUN --mount=type=bind,from=sdk,source=/opt/hfendpoints/dist,target=/usr/local/en
10
 
11
  COPY handler.py /usr/local/endpoint/
12
 
 
 
 
 
 
 
 
13
  ENV INTERFACE=0.0.0.0
14
  ENV PORT=80
15
 
16
  EXPOSE 80
 
17
  ENTRYPOINT ["python3"]
18
  CMD ["/usr/local/endpoint/handler.py"]
 
2
  FROM huggingface/hfendpoints-sdk:${SDK_VERSION} AS sdk
3
 
4
  FROM python:3.12-bookworm
5
+
6
+ RUN apt update && apt install -y libjemalloc2
7
  RUN --mount=type=bind,from=sdk,source=/opt/hfendpoints/dist,target=/usr/local/endpoints/dist \
8
  --mount=type=bind,source=requirements.txt,target=/tmp/requirements.txt \
9
  python3 -m pip install torch --index-url https://download.pytorch.org/whl/cpu && \
 
12
 
13
  COPY handler.py /usr/local/endpoint/
14
 
15
+ # OMP & MALLOC related tuning
16
+ ENV KMP_AFFINITY="granularity=fine,compact,1,0"
17
+ ENV KMP_BLOCKTIME=1
18
+ ENV MALLOC_CONF=oversize_threshold:1,background_thread:true,metadata_thp:auto,dirty_decay_ms:9000000000,muzzy_decay_ms:9000000000
19
+ ENV LD_PRELOAD=/usr/local/lib/libiomp5.so;/usr/lib/x86_64-linux-gnu/libjemalloc.so.2
20
+
21
+ # Network interface
22
  ENV INTERFACE=0.0.0.0
23
  ENV PORT=80
24
 
25
  EXPOSE 80
26
+
27
  ENTRYPOINT ["python3"]
28
  CMD ["/usr/local/endpoint/handler.py"]
requirements.txt CHANGED
@@ -1,6 +1,7 @@
1
  # auto-round>=0.5.0
2
  loguru>=0.7.3
3
  intel-extension-for-pytorch>=2.7.0
 
4
  sentence-transformers
5
  # transformers>=4.51
6
  torch>=2.5.0
 
1
  # auto-round>=0.5.0
2
  loguru>=0.7.3
3
  intel-extension-for-pytorch>=2.7.0
4
+ intel-openmp>=2025.1.1
5
  sentence-transformers
6
  # transformers>=4.51
7
  torch>=2.5.0