Spaces:
Sleeping
Sleeping
MouadHsb
commited on
Commit
·
b265554
1
Parent(s):
8d6ba4f
Trying to load model directly to cpu
Browse files
app/services/embedding_service.py
CHANGED
@@ -27,7 +27,8 @@ class EmbeddingService:
|
|
27 |
# Force the model to load fully into memory without any meta tensors
|
28 |
torch.cuda.empty_cache() if torch.cuda.is_available() else None
|
29 |
|
30 |
-
|
|
|
31 |
|
32 |
# Ensure model is fully materialized, not using meta tensors
|
33 |
for param in self.model.parameters():
|
|
|
27 |
# Force the model to load fully into memory without any meta tensors
|
28 |
torch.cuda.empty_cache() if torch.cuda.is_available() else None
|
29 |
|
30 |
+
model_args = {'device_map': 'cpu'}
|
31 |
+
self.model = SentenceTransformer(model_name, model_args=model_args, device="cpu")
|
32 |
|
33 |
# Ensure model is fully materialized, not using meta tensors
|
34 |
for param in self.model.parameters():
|