Spaces:
Sleeping
Sleeping
Update my_model/KBVQA.py
Browse files- my_model/KBVQA.py +5 -0
my_model/KBVQA.py
CHANGED
|
@@ -257,6 +257,10 @@ def prepare_kbvqa_model(only_reload_detection_model: bool = False, force_reload:
|
|
| 257 |
|
| 258 |
if force_reload:
|
| 259 |
loading_message = 'Force Reloading model.. this should take no more than a few minutes!'
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
else: loading_message = 'Looading model.. this should take no more than a few minutes!'
|
| 261 |
|
| 262 |
with st.spinner(loading_message):
|
|
@@ -272,6 +276,7 @@ def prepare_kbvqa_model(only_reload_detection_model: bool = False, force_reload:
|
|
| 272 |
free_gpu_resources()
|
| 273 |
progress_bar.progress(100)
|
| 274 |
else:
|
|
|
|
| 275 |
progress_bar = st.progress(0)
|
| 276 |
kbvqa.load_detector(kbvqa.detection_model)
|
| 277 |
progress_bar.progress(100)
|
|
|
|
| 257 |
|
| 258 |
if force_reload:
|
| 259 |
loading_message = 'Force Reloading model.. this should take no more than a few minutes!'
|
| 260 |
+
if kbvqa is not None:
|
| 261 |
+
del kbvqa
|
| 262 |
+
free_gpu_resources()
|
| 263 |
+
free_gpu_resources()
|
| 264 |
else: loading_message = 'Looading model.. this should take no more than a few minutes!'
|
| 265 |
|
| 266 |
with st.spinner(loading_message):
|
|
|
|
| 276 |
free_gpu_resources()
|
| 277 |
progress_bar.progress(100)
|
| 278 |
else:
|
| 279 |
+
free_gpu_resources()
|
| 280 |
progress_bar = st.progress(0)
|
| 281 |
kbvqa.load_detector(kbvqa.detection_model)
|
| 282 |
progress_bar.progress(100)
|