Spaces:
Sleeping
Sleeping
Commit
·
473fd36
1
Parent(s):
f2704bd
Force CPU for embeddings and add ingest logging
Browse files- apps/web/app.py +3 -0
- services/rag/embed.py +2 -1
apps/web/app.py
CHANGED
|
@@ -119,6 +119,9 @@ def admin_ingest(files):
|
|
| 119 |
init_services()
|
| 120 |
status += "Services reloaded. Ready to chat."
|
| 121 |
except Exception as e:
|
|
|
|
|
|
|
|
|
|
| 122 |
status += f"Error: {e}"
|
| 123 |
|
| 124 |
return status
|
|
|
|
| 119 |
init_services()
|
| 120 |
status += "Services reloaded. Ready to chat."
|
| 121 |
except Exception as e:
|
| 122 |
+
print(f"Ingestion Failed: {e}") # Print to server logs
|
| 123 |
+
import traceback
|
| 124 |
+
traceback.print_exc()
|
| 125 |
status += f"Error: {e}"
|
| 126 |
|
| 127 |
return status
|
services/rag/embed.py
CHANGED
|
@@ -16,7 +16,8 @@ class Embedder:
|
|
| 16 |
self.client = OpenAI(api_key=api_key)
|
| 17 |
else:
|
| 18 |
print(f"Loading local embedding model: {model_name}")
|
| 19 |
-
|
|
|
|
| 20 |
|
| 21 |
def embed(self, texts: List[str]) -> np.ndarray:
|
| 22 |
if not texts:
|
|
|
|
| 16 |
self.client = OpenAI(api_key=api_key)
|
| 17 |
else:
|
| 18 |
print(f"Loading local embedding model: {model_name}")
|
| 19 |
+
# Force CPU to avoid ZeroGPU conflicts during ingestion
|
| 20 |
+
self.model = SentenceTransformer(model_name, device="cpu")
|
| 21 |
|
| 22 |
def embed(self, texts: List[str]) -> np.ndarray:
|
| 23 |
if not texts:
|