sksameermujahid commited on
Commit
32b1152
·
verified ·
1 Parent(s): 774f1e6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -60,13 +60,13 @@ conversation_context = {}
60
  def load_sentence_transformer():
61
  print("Loading SentenceTransformer model...")
62
  try:
63
- # Load the model directly with trust_remote_code
 
 
 
 
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.")