LiamKhoaLe commited on
Commit
b9c2d22
·
1 Parent(s): a3b4c21

Migrate model debug on app

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -67,12 +67,18 @@ for root, dirs, files in os.walk(MODEL_CACHE_DIR):
67
  for file in files:
68
  print(f" 📄 {file}")
69
  # Check if the required model files exist
70
- if os.path.exists(os.path.join(MODEL_CACHE_DIR, "config.json")):
71
- print(f"✅ Found cached model at {MODEL_CACHE_DIR}")
72
- model_loc = MODEL_CACHE_DIR
 
 
 
 
 
 
73
  else:
74
- print(f"❌ Model not found in {MODEL_CACHE_DIR}. Critical error!")
75
- exit(1) # Exit since the model is missing
76
  # 3. Load the model to application
77
  from sentence_transformers import SentenceTransformer
78
  print("📥 **Loading Embedding Model...**")
 
67
  for file in files:
68
  print(f" 📄 {file}")
69
  # Check if the required model files exist
70
+ snapshots_path = os.path.join(MODEL_CACHE_DIR, "models--sentence-transformers--all-MiniLM-L6-v2/snapshots")
71
+ if os.path.exists(snapshots_path):
72
+ snapshot_folders = os.listdir(snapshots_path)
73
+ if snapshot_folders:
74
+ model_loc = os.path.join(snapshots_path, snapshot_folders[0])
75
+ print(f"✅ Found model snapshot at {model_loc}")
76
+ else:
77
+ print("❌ No snapshot folder found!")
78
+ exit(1)
79
  else:
80
+ print("❌ No snapshots directory found!")
81
+ exit(1)
82
  # 3. Load the model to application
83
  from sentence_transformers import SentenceTransformer
84
  print("📥 **Loading Embedding Model...**")