Morgan Funtowicz
commited on
Commit
·
6520a09
1
Parent(s):
fb05b22
test(hfjobs): various fix
Browse files- .hfjobs/Dockerfile +1 -1
- Dockerfile +2 -2
- tests/test_openai.py +1 -2
.hfjobs/Dockerfile
CHANGED
|
@@ -5,10 +5,10 @@ ARG ENDPOINT_URL="http://host.docker.internal:8000"
|
|
| 5 |
ARG ENDPOINT_NUM_SAMPLES=50
|
| 6 |
ARG ENDPOINT_TEST_SEED=31415926
|
| 7 |
|
| 8 |
-
ENV ENDPOINT_API_KEY=$ENDPOINT_API_KEY
|
| 9 |
ENV ENDPOINT_URL=$ENDPOINT_URL
|
| 10 |
ENV ENDPOINT_NUM_SAMPLES=$ENDPOINT_NUM_SAMPLES
|
| 11 |
ENV ENDPOINT_TEST_SEED=$ENDPOINT_TEST_SEED
|
|
|
|
| 12 |
|
| 13 |
RUN --mount=type=bind,source=.hfjobs/requirements.txt,target=/opt/endpoint/tests/requirements.txt \
|
| 14 |
python -m pip install -r /opt/endpoint/tests/requirements.txt
|
|
|
|
| 5 |
ARG ENDPOINT_NUM_SAMPLES=50
|
| 6 |
ARG ENDPOINT_TEST_SEED=31415926
|
| 7 |
|
|
|
|
| 8 |
ENV ENDPOINT_URL=$ENDPOINT_URL
|
| 9 |
ENV ENDPOINT_NUM_SAMPLES=$ENDPOINT_NUM_SAMPLES
|
| 10 |
ENV ENDPOINT_TEST_SEED=$ENDPOINT_TEST_SEED
|
| 11 |
+
ENV HF_HOME=/tmp/huggingface
|
| 12 |
|
| 13 |
RUN --mount=type=bind,source=.hfjobs/requirements.txt,target=/opt/endpoint/tests/requirements.txt \
|
| 14 |
python -m pip install -r /opt/endpoint/tests/requirements.txt
|
Dockerfile
CHANGED
|
@@ -2,10 +2,10 @@ ARG SDK_VERSION=latest
|
|
| 2 |
FROM huggingface/hfendpoints-sdk:${SDK_VERSION} AS sdk
|
| 3 |
|
| 4 |
FROM vllm/vllm-openai:v0.8.4
|
| 5 |
-
RUN --mount=type=bind,from=sdk,source=/
|
| 6 |
--mount=type=bind,source=requirements.txt,target=/tmp/requirements.txt \
|
| 7 |
python3 -m pip install -r /tmp/requirements.txt && \
|
| 8 |
-
python3 -m pip install /usr/local/
|
| 9 |
|
| 10 |
COPY handler.py /usr/local/endpoint/
|
| 11 |
|
|
|
|
| 2 |
FROM huggingface/hfendpoints-sdk:${SDK_VERSION} AS sdk
|
| 3 |
|
| 4 |
FROM vllm/vllm-openai:v0.8.4
|
| 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 -r /tmp/requirements.txt && \
|
| 8 |
+
python3 -m pip install /usr/local/endpoints/dist/*.whl
|
| 9 |
|
| 10 |
COPY handler.py /usr/local/endpoint/
|
| 11 |
|
tests/test_openai.py
CHANGED
|
@@ -7,7 +7,6 @@ import soundfile as sf
|
|
| 7 |
import pytest
|
| 8 |
|
| 9 |
# Global variables defining endpoint targets
|
| 10 |
-
ENDPOINT_API_KEY = environ["ENDPOINT_API_KEY"]
|
| 11 |
ENDPOINT_URL = environ["ENDPOINT_URL"]
|
| 12 |
ENDPOINT_NUM_SAMPLES = int(environ["ENDPOINT_NUM_SAMPLES"])
|
| 13 |
ENDPOINT_TEST_SEED = int(environ["ENDPOINT_TEST_SEED"])
|
|
@@ -20,7 +19,7 @@ from datasets import load_dataset, Dataset
|
|
| 20 |
from openai import OpenAI
|
| 21 |
|
| 22 |
# Global client to make requests
|
| 23 |
-
client = OpenAI(
|
| 24 |
|
| 25 |
|
| 26 |
@pytest.fixture
|
|
|
|
| 7 |
import pytest
|
| 8 |
|
| 9 |
# Global variables defining endpoint targets
|
|
|
|
| 10 |
ENDPOINT_URL = environ["ENDPOINT_URL"]
|
| 11 |
ENDPOINT_NUM_SAMPLES = int(environ["ENDPOINT_NUM_SAMPLES"])
|
| 12 |
ENDPOINT_TEST_SEED = int(environ["ENDPOINT_TEST_SEED"])
|
|
|
|
| 19 |
from openai import OpenAI
|
| 20 |
|
| 21 |
# Global client to make requests
|
| 22 |
+
client = OpenAI(base_url=ENDPOINT_URL)
|
| 23 |
|
| 24 |
|
| 25 |
@pytest.fixture
|