From 089cfe8076054802c8898e05867dcf0b28a3c122 Mon Sep 17 00:00:00 2001 From: oznav2 Date: Mon, 28 Oct 2024 09:29:51 +0200 Subject: [PATCH] version 0.3.35 --- Dockerfile.local | 9 ++++-- backend/open_webui/apps/retrieval/main.py | 36 +++++++++++------------ docker-compose-myCustomizations.yaml | 2 +- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/Dockerfile.local b/Dockerfile.local index c682bccc43..114c38eed0 100644 --- a/Dockerfile.local +++ b/Dockerfile.local @@ -35,7 +35,7 @@ ENV APP_BUILD_HASH=${BUILD_HASH} RUN npm run build ######## WebUI backend ######## -FROM python:3.11-slim-bookworm as base +FROM python:3.11-slim-bookworm AS base # Use args ARG USE_CUDA @@ -187,7 +187,7 @@ RUN pip3 install uv && \ echo "========Installing CUDA version======" && \ pip3 install torch torchvision torchaudio --no-cache-dir && \ # Install requirements.txt - uv pip install -r requirements.txt --no-cache-dir && \ + pip3 install -r requirements.txt --no-cache-dir && \ # Verify imports and model loading python -c "import os; from sentence_transformers import SentenceTransformer; SentenceTransformer(os.environ['RAG_EMBEDDING_MODEL'], device='cpu')" && \ python -c "import os; from faster_whisper import WhisperModel; WhisperModel(os.environ['WHISPER_MODEL'], device='cpu', compute_type='int8', download_root=os.environ['WHISPER_MODEL_DIR'])"; \ @@ -215,6 +215,11 @@ COPY --chown=$UID:$GID --from=build /app/package.json /app/package.json # Copy backend files COPY --chown=$UID:$GID ./backend . +# provide group with same permissions as user +# allows running in OpenShift +RUN chmod -R g=u /app $HOME + + EXPOSE 8080 HEALTHCHECK CMD curl --silent --fail http://localhost:${PORT:-8080}/health | jq -ne 'input.status == true' || exit 1 diff --git a/backend/open_webui/apps/retrieval/main.py b/backend/open_webui/apps/retrieval/main.py index 5b4085a7f3..e9ca3b67df 100644 --- a/backend/open_webui/apps/retrieval/main.py +++ b/backend/open_webui/apps/retrieval/main.py @@ -175,30 +175,14 @@ app.state.config.RAG_WEB_SEARCH_CONCURRENT_REQUESTS = RAG_WEB_SEARCH_CONCURRENT_REQUESTS -# def update_embedding_model( -# embedding_model: str, -# auto_update: bool = False, -# ): -# if embedding_model and app.state.config.RAG_EMBEDDING_ENGINE == "": -# from sentence_transformers import SentenceTransformer - -# app.state.sentence_transformer_ef = SentenceTransformer( -# get_model_path(embedding_model, auto_update), -# device=DEVICE_TYPE, -# trust_remote_code=RAG_EMBEDDING_MODEL_TRUST_REMOTE_CODE, -# ) -# else: -# app.state.sentence_transformer_ef = None - -# reverting to old version of this function def update_embedding_model( embedding_model: str, auto_update: bool = False, ): if embedding_model and app.state.config.RAG_EMBEDDING_ENGINE == "": - import sentence_transformers + from sentence_transformers import SentenceTransformer - app.state.sentence_transformer_ef = sentence_transformers.SentenceTransformer( + app.state.sentence_transformer_ef = SentenceTransformer( get_model_path(embedding_model, auto_update), device=DEVICE_TYPE, trust_remote_code=RAG_EMBEDDING_MODEL_TRUST_REMOTE_CODE, @@ -206,6 +190,22 @@ def update_embedding_model( else: app.state.sentence_transformer_ef = None +# reverting to old version of this function +# def update_embedding_model( +# embedding_model: str, +# auto_update: bool = False, +# ): +# if embedding_model and app.state.config.RAG_EMBEDDING_ENGINE == "": +# import sentence_transformers + +# app.state.sentence_transformer_ef = sentence_transformers.SentenceTransformer( +# get_model_path(embedding_model, auto_update), +# device=DEVICE_TYPE, +# trust_remote_code=RAG_EMBEDDING_MODEL_TRUST_REMOTE_CODE, +# ) +# else: +# app.state.sentence_transformer_ef = None + def update_reranking_model( reranking_model: str, auto_update: bool = False, diff --git a/docker-compose-myCustomizations.yaml b/docker-compose-myCustomizations.yaml index 3ab203efb7..25dc511ddb 100644 --- a/docker-compose-myCustomizations.yaml +++ b/docker-compose-myCustomizations.yaml @@ -40,7 +40,7 @@ services: - OPENAI_API_BASE_URL=http://pipelines:9099 - OPENAI_API_KEY=0p3n-w3bu! - TIKTOKEN_ENCODING_NAME=cl100k_base - - RAG_EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2 + - RAG_EMBEDDING_MODEL=intfloat/multilingual-e5-large - WHISPER_MODEL=ivrit-ai/faster-whisper-v2-d3-e3 - WHISPER_MODEL_DIR=/app/backend/data/cache/whisper/models - SENTENCE_TRANSFORMERS_HOME=/app/backend/data/cache/embedding/models