force offline local MiniLM (no internet, no cache)
Browse files
rag.py
CHANGED
|
@@ -103,7 +103,6 @@ def get_texts() -> List[str]:
|
|
| 103 |
print(f"⚠ Dataset fetch failed: {e} – using empty corpus")
|
| 104 |
return []
|
| 105 |
|
| 106 |
-
# ------------------------------------------------------------------
|
| 107 |
# ------------------------------------------------------------------
|
| 108 |
@lru_cache(maxsize=1)
|
| 109 |
def get_vectorstore() -> FAISS:
|
|
@@ -115,6 +114,10 @@ def get_vectorstore() -> FAISS:
|
|
| 115 |
os.path.join(os.path.dirname(__file__), "st_model")
|
| 116 |
)
|
| 117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
from sentence_transformers import SentenceTransformer
|
| 119 |
model = SentenceTransformer(local_model_path, device="cpu", cache_folder=None)
|
| 120 |
|
|
|
|
| 103 |
print(f"⚠ Dataset fetch failed: {e} – using empty corpus")
|
| 104 |
return []
|
| 105 |
|
|
|
|
| 106 |
# ------------------------------------------------------------------
|
| 107 |
@lru_cache(maxsize=1)
|
| 108 |
def get_vectorstore() -> FAISS:
|
|
|
|
| 114 |
os.path.join(os.path.dirname(__file__), "st_model")
|
| 115 |
)
|
| 116 |
|
| 117 |
+
# force transformers to read local files only
|
| 118 |
+
os.environ["TRANSFORMERS_OFFLINE"] = "1"
|
| 119 |
+
os.environ["HF_DATASETS_OFFLINE"] = "1"
|
| 120 |
+
|
| 121 |
from sentence_transformers import SentenceTransformer
|
| 122 |
model = SentenceTransformer(local_model_path, device="cpu", cache_folder=None)
|
| 123 |
|