Spaces:
Sleeping
Sleeping
Update my_model/utilities.py
Browse files- my_model/utilities.py +7 -8
my_model/utilities.py
CHANGED
@@ -298,14 +298,13 @@ def free_gpu_resources():
|
|
298 |
"""
|
299 |
try:
|
300 |
if torch.cuda.is_available():
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
st.write(f"Error occurred while clearing GPU memory")
|
309 |
|
310 |
|
311 |
|
|
|
298 |
"""
|
299 |
try:
|
300 |
if torch.cuda.is_available():
|
301 |
+
torch.cuda.empty_cache()
|
302 |
+
torch.cuda.empty_cache()
|
303 |
+
gc.collect()
|
304 |
+
gc.collect()
|
305 |
+
|
306 |
+
st.write("GPU memory has been cleared.")
|
307 |
+
|
|
|
308 |
|
309 |
|
310 |
|