Spaces:
Runtime error
Runtime error
Commit
·
af5e898
1
Parent(s):
f5f3d9d
add embed_model
Browse files
app.py
CHANGED
@@ -524,11 +524,11 @@ embed_model_id = 'sentence-transformers/all-MiniLM-L6-v2'
|
|
524 |
|
525 |
# device = f'cuda:{cuda.current_device()}' if cuda.is_available() else 'cpu'
|
526 |
device = 'cpu'
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
|
533 |
embeddings = embeddings_openai
|
534 |
|
|
|
524 |
|
525 |
# device = f'cuda:{cuda.current_device()}' if cuda.is_available() else 'cpu'
|
526 |
device = 'cpu'
|
527 |
+
embed_model = HuggingFaceEmbeddings(
|
528 |
+
model_name=embed_model_id,
|
529 |
+
model_kwargs={'device': device},
|
530 |
+
encode_kwargs={'device': device, 'batch_size': 32}
|
531 |
+
)
|
532 |
|
533 |
embeddings = embeddings_openai
|
534 |
|