Update my_model/KBVQA.py
Browse files- my_model/KBVQA.py +2 -2
my_model/KBVQA.py
CHANGED
@@ -168,7 +168,7 @@ class KBVQA:
|
|
168 |
|
169 |
return self.kbvqa_model is not None and self.captioner is not None and self.detector is not None
|
170 |
|
171 |
-
def
|
172 |
"""
|
173 |
Forces a reload of all models, freeing up GPU resources. This method deletes the current models and calls `free_gpu_resources`.
|
174 |
"""
|
@@ -186,7 +186,6 @@ class KBVQA:
|
|
186 |
|
187 |
free_gpu_resources()
|
188 |
|
189 |
-
return prepare_kbvqa_model(only_reload_detection_model=False, force_reload=True)
|
190 |
|
191 |
|
192 |
def format_prompt(self, current_query: str, history: Optional[str] = None, sys_prompt: Optional[str] = None, caption: str = None, objects: Optional[str] = None) -> str:
|
@@ -275,6 +274,7 @@ def prepare_kbvqa_model(only_reload_detection_model: bool = False, force_reload:
|
|
275 |
# Progress bar for model loading
|
276 |
with kbvqa.col1:
|
277 |
if force_reload:
|
|
|
278 |
loading_message = 'Force Reloading model.. this should take no more than a few minutes!'
|
279 |
else: loading_message = 'Looading model.. this should take no more than a few minutes!'
|
280 |
|
|
|
168 |
|
169 |
return self.kbvqa_model is not None and self.captioner is not None and self.detector is not None
|
170 |
|
171 |
+
def delete_model(self):
|
172 |
"""
|
173 |
Forces a reload of all models, freeing up GPU resources. This method deletes the current models and calls `free_gpu_resources`.
|
174 |
"""
|
|
|
186 |
|
187 |
free_gpu_resources()
|
188 |
|
|
|
189 |
|
190 |
|
191 |
def format_prompt(self, current_query: str, history: Optional[str] = None, sys_prompt: Optional[str] = None, caption: str = None, objects: Optional[str] = None) -> str:
|
|
|
274 |
# Progress bar for model loading
|
275 |
with kbvqa.col1:
|
276 |
if force_reload:
|
277 |
+
self.delete_model()
|
278 |
loading_message = 'Force Reloading model.. this should take no more than a few minutes!'
|
279 |
else: loading_message = 'Looading model.. this should take no more than a few minutes!'
|
280 |
|