XThomasBU
commited on
Commit
·
65ce8c0
1
Parent(s):
f21709c
minor fix
Browse files
code/modules/vectorstore/store_manager.py
CHANGED
@@ -139,13 +139,15 @@ class VectorStoreManager:
|
|
139 |
try:
|
140 |
self.loaded_vector_db = self.vector_db._load_database(self.embedding_model)
|
141 |
except Exception as e:
|
142 |
-
raise ValueError(
|
|
|
|
|
143 |
# print(f"Creating database")
|
144 |
# self.create_database()
|
145 |
# self.loaded_vector_db = self.vector_db._load_database(self.embedding_model)
|
146 |
end_time = time.time() # End time for loading database
|
147 |
self.logger.info(
|
148 |
-
f"Time taken to load database {self.config['vectorstore']['db_option']}
|
149 |
)
|
150 |
self.logger.info("Loaded database")
|
151 |
return self.loaded_vector_db
|
@@ -173,12 +175,16 @@ if __name__ == "__main__":
|
|
173 |
vector_db = VectorStoreManager(config)
|
174 |
if config["vectorstore"]["load_from_HF"]:
|
175 |
if config["vectorstore"]["db_option"] in RETRIEVER_HF_PATHS:
|
176 |
-
vector_db.load_from_HF(
|
|
|
|
|
177 |
else:
|
178 |
# print(f"HF_PATH not available for {config['vectorstore']['db_option']}")
|
179 |
# print("Creating database")
|
180 |
# vector_db.create_database()
|
181 |
-
raise ValueError(
|
|
|
|
|
182 |
else:
|
183 |
vector_db.create_database()
|
184 |
print("Created database")
|
|
|
139 |
try:
|
140 |
self.loaded_vector_db = self.vector_db._load_database(self.embedding_model)
|
141 |
except Exception as e:
|
142 |
+
raise ValueError(
|
143 |
+
f"Error loading database, check if it exists. if not run python -m modules.vectorstore.store_manager / Resteart the HF Space: {e}"
|
144 |
+
)
|
145 |
# print(f"Creating database")
|
146 |
# self.create_database()
|
147 |
# self.loaded_vector_db = self.vector_db._load_database(self.embedding_model)
|
148 |
end_time = time.time() # End time for loading database
|
149 |
self.logger.info(
|
150 |
+
f"Time taken to load database {self.config['vectorstore']['db_option']}: {end_time - start_time} seconds"
|
151 |
)
|
152 |
self.logger.info("Loaded database")
|
153 |
return self.loaded_vector_db
|
|
|
175 |
vector_db = VectorStoreManager(config)
|
176 |
if config["vectorstore"]["load_from_HF"]:
|
177 |
if config["vectorstore"]["db_option"] in RETRIEVER_HF_PATHS:
|
178 |
+
vector_db.load_from_HF(
|
179 |
+
HF_PATH=RETRIEVER_HF_PATHS[config["vectorstore"]["db_option"]]
|
180 |
+
)
|
181 |
else:
|
182 |
# print(f"HF_PATH not available for {config['vectorstore']['db_option']}")
|
183 |
# print("Creating database")
|
184 |
# vector_db.create_database()
|
185 |
+
raise ValueError(
|
186 |
+
f"HF_PATH not available for {config['vectorstore']['db_option']}"
|
187 |
+
)
|
188 |
else:
|
189 |
vector_db.create_database()
|
190 |
print("Created database")
|