From cd117f5b677bdc5983dbc151eeadc2fd616913dd Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Thu, 19 Sep 2024 21:51:45 +0200 Subject: [PATCH] refac --- Dockerfile | 4 ++++ backend/open_webui/apps/rag/main.py | 12 ------------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 795a1141a..513749e1d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -74,6 +74,10 @@ ENV RAG_EMBEDDING_MODEL="$USE_EMBEDDING_MODEL_DOCKER" \ ## Hugging Face download cache ## ENV HF_HOME="/app/backend/data/cache/embedding/models" + +## Torch Extensions ## +ENV TORCH_EXTENSIONS_DIR="/app/backend/data/cache/torch_extensions" + #### Other models ########################################################## WORKDIR /app/backend diff --git a/backend/open_webui/apps/rag/main.py b/backend/open_webui/apps/rag/main.py index 3ba52ae7f..fb3b2fb43 100644 --- a/backend/open_webui/apps/rag/main.py +++ b/backend/open_webui/apps/rag/main.py @@ -206,18 +206,6 @@ def update_reranking_model( print("ColBERT: Loading model", name) self.device = "cuda" if torch.cuda.is_available() else "cpu" - if DOCKER: - # This is a workaround for the issue with the docker container - # where the torch extension is not loaded properly - # and the following error is thrown: - # /root/.cache/torch_extensions/py311_cpu/segmented_maxsim_cpp/segmented_maxsim_cpp.so: cannot open shared object file: No such file or directory - - lock_file = "/root/.cache/torch_extensions/py311_cpu/segmented_maxsim_cpp/lock" - if os.path.exists(lock_file): - os.remove(lock_file) - print("ColBERT: Removed lock file") - - self.ckpt = Checkpoint( name, colbert_config=ColBERTConfig(model_name=name),