Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -60,13 +60,13 @@ conversation_context = {}
|
|
60 |
def load_sentence_transformer():
|
61 |
print("Loading SentenceTransformer model...")
|
62 |
try:
|
63 |
-
#
|
|
|
|
|
|
|
|
|
64 |
from sentence_transformers import SentenceTransformer
|
65 |
-
model_embedding = SentenceTransformer(
|
66 |
-
'jinaai/jina-embeddings-v3',
|
67 |
-
device=device,
|
68 |
-
trust_remote_code=True
|
69 |
-
)
|
70 |
|
71 |
if not os.path.exists(MODEL_PATH):
|
72 |
raise FileNotFoundError(f"Model state dict not found at {MODEL_PATH}. Please ensure the file exists.")
|
|
|
60 |
def load_sentence_transformer():
|
61 |
print("Loading SentenceTransformer model...")
|
62 |
try:
|
63 |
+
# First download the model files
|
64 |
+
from huggingface_hub import snapshot_download
|
65 |
+
model_path = snapshot_download(repo_id="jinaai/jina-embeddings-v3")
|
66 |
+
|
67 |
+
# Then load it with SentenceTransformer
|
68 |
from sentence_transformers import SentenceTransformer
|
69 |
+
model_embedding = SentenceTransformer(model_path).to(device)
|
|
|
|
|
|
|
|
|
70 |
|
71 |
if not os.path.exists(MODEL_PATH):
|
72 |
raise FileNotFoundError(f"Model state dict not found at {MODEL_PATH}. Please ensure the file exists.")
|