picocreator commited on
Commit
0b1be7c
1 Parent(s): 59618c7

Update app.py

Browse files

Trying to get it to work for CPU mode

Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -99,12 +99,17 @@ def evaluate(
99
  yield out_str.strip()
100
  out_last = i + 1
101
 
102
- gpu_info = nvmlDeviceGetMemoryInfo(gpu_h)
103
- print(f'vram {gpu_info.total} used {gpu_info.used} free {gpu_info.free}')
 
 
104
  del out
105
  del state
106
  gc.collect()
107
- torch.cuda.empty_cache()
 
 
 
108
  yield out_str.strip()
109
 
110
  # Examples and gradio blocks
 
99
  yield out_str.strip()
100
  out_last = i + 1
101
 
102
+ if HAS_GPU == True :
103
+ gpu_info = nvmlDeviceGetMemoryInfo(gpu_h)
104
+ print(f'vram {gpu_info.total} used {gpu_info.used} free {gpu_info.free}')
105
+
106
  del out
107
  del state
108
  gc.collect()
109
+
110
+ if HAS_GPU == True :
111
+ torch.cuda.empty_cache()
112
+
113
  yield out_str.strip()
114
 
115
  # Examples and gradio blocks