MikeMann commited on
Commit
3925794
·
1 Parent(s): 99995bc

added EvalDataset Generation

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -95,8 +95,16 @@ class BSIChatbot:
95
  #self.vectorstore: VectorStore = None
96
 
97
  def cleanResources(self):
 
 
98
  multiprocessing.active_children()
 
99
  print(multiprocessing.active_children())
 
 
 
 
 
100
  #multiprocessing.resource_tracker.unregister('Semaphore')
101
  torch.cuda.empty_cache()
102
  gc.collect()
@@ -246,6 +254,7 @@ class BSIChatbot:
246
  else:
247
  start = time.time()
248
  if vectorstore is None:
 
249
  vectorstore = FAISS.load_local(self.embedPath, self.embedding_model, allow_dangerous_deserialization=True)
250
  #self.vectorstore.index = index_gpu
251
  end = time.time()
@@ -310,7 +319,9 @@ class BSIChatbot:
310
 
311
  def initializeRerankingModel(self):
312
  global rerankingModel
313
- rerankingModel = RAGPretrainedModel.from_pretrained(self.rerankModelPath)
 
 
314
 
315
 
316
  def retrieval(self, query, rerankingStep, hybridSearch):
 
95
  #self.vectorstore: VectorStore = None
96
 
97
  def cleanResources(self):
98
+ print(f"GPU Memory Allocated: {torch.cuda.memory_allocated() / 1024 / 1024} MB")
99
+ print(f"GPU Memory Cached: {torch.cuda.memory_reserved() / 1024 / 1024} MB")
100
  multiprocessing.active_children()
101
+ print("processes:")
102
  print(multiprocessing.active_children())
103
+
104
+ for child in multiprocessing.active_children():
105
+ child.terminate()
106
+ child.join()
107
+
108
  #multiprocessing.resource_tracker.unregister('Semaphore')
109
  torch.cuda.empty_cache()
110
  gc.collect()
 
254
  else:
255
  start = time.time()
256
  if vectorstore is None:
257
+ print("Checkpoint: FAISS Vectorstore initialized...")
258
  vectorstore = FAISS.load_local(self.embedPath, self.embedding_model, allow_dangerous_deserialization=True)
259
  #self.vectorstore.index = index_gpu
260
  end = time.time()
 
319
 
320
  def initializeRerankingModel(self):
321
  global rerankingModel
322
+ if rerankingModel is None:
323
+ print("Checkpoint: Reranker initialized...")
324
+ rerankingModel = RAGPretrainedModel.from_pretrained(self.rerankModelPath)
325
 
326
 
327
  def retrieval(self, query, rerankingStep, hybridSearch):