Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Update Faiss workaround code #1009

davidmezzettif7d5790d0783
diff --git a/src/python/txtai/ann/dense/faiss.py b/src/python/txtai/ann/dense/faiss.py
index de9a9847..40480d55 100644
--- a/src/python/txtai/ann/dense/faiss.py
+++ b/src/python/txtai/ann/dense/faiss.py
@@ -9,10 +9,10 @@ import platform
# pylint: disable=C0413
if platform.system() == "Darwin" or os.name == "nt":
# Workaround for a Faiss issue causing segmentation faults. See txtai FAQ for more.
- os.environ["OMP_NUM_THREADS"] = "1"
+ os.environ["OMP_NUM_THREADS"] = os.environ.get("OMP_NUM_THREADS", "1")
# Workaround for a Faiss issue with OMP: Error #15. See txtai FAQ for more.
- os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE"
+ os.environ["KMP_DUPLICATE_LIB_OK"] = os.environ.get("KMP_DUPLICATE_LIB_OK", "TRUE")
import numpy as np