Skip to content

Commit

Permalink
Fix issue for reranking-langchain-mosec.
Browse files Browse the repository at this point in the history
Signed-off-by: zepan <[email protected]>
  • Loading branch information
ZePan110 committed Aug 12, 2024
1 parent ddfbad6 commit c23f83a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions comps/reranks/langchain-mosec/mosec-docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ ENV GLIBC_TUNABLES glibc.cpu.x86_shstk=permissive
COPY comps /home/user/comps

RUN apt update && apt install -y python3 python3-pip
USER user

RUN pip3 install torch==2.2.2 torchvision --trusted-host download.pytorch.org --index-url https://download.pytorch.org/whl/cpu
RUN pip3 install intel-extension-for-pytorch==2.2.0
RUN pip3 install transformers sentence-transformers
RUN pip3 install llmspec mosec

RUN cd /home/user/ && export HF_ENDPOINT=https://hf-mirror.com && huggingface-cli download --resume-download BAAI/bge-reranker-large --local-dir /home/user/bge-reranker-large

USER user
ENV EMB_MODEL="/home/user/bge-reranker-large/"

WORKDIR /home/user/comps/reranks/langchain-mosec/mosec-docker
Expand Down
2 changes: 1 addition & 1 deletion comps/reranks/langchain-mosec/mosec-docker/server-ipex.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from torch.utils.data import DataLoader
from tqdm.autonotebook import tqdm, trange

DEFAULT_MODEL = "/root/bge-reranker-large"
DEFAULT_MODEL = "/home/user/bge-reranker-large"


class MyCrossEncoder(CrossEncoder):
Expand Down
16 changes: 8 additions & 8 deletions tests/test_reranks_langchain-mosec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ function start_service() {
}

function validate_microservice() {
mosec_service_port=5007
HTTP_STATUS=$(http_proxy="" curl -w "%{http_code}" http://${ip_address}:${mosec_service_port}/v1/reranking\
mosec_service_port=5002
result=$(http_proxy="" curl http://${ip_address}:$mosec_service_port/v1/embeddings \
-X POST \
-d '{"initial_query":"What is Deep Learning?", "retrieved_docs": [{"text":"Deep Learning is not..."}, {"text":"Deep learning is..."}]}' \
-d '{"text":"What is Deep Learning?"}' \
-H 'Content-Type: application/json')
if [ "$HTTP_STATUS" -eq 200 ]; then
echo "Result correct. HTTP status is 200."
if [[ $result == *"Human"* ]]; then
echo "Result correct."
else
echo "Result wrong. HTTP status is not 200. Received status was $HTTP_STATUS"
docker logs test-comps-reranking-langchain-mosec-server
echo "Result wrong. Received was $result"
docker logs test-comps-reranking-langchain-mosec-endpoint
docker logs test-comps-reranking-langchain-mosec-server
exit 1
fi
fi
}

function stop_docker() {
Expand Down

0 comments on commit c23f83a

Please sign in to comment.