@@ -253,9 +253,9 @@ def load_img(path, h0, w0):
253
253
init_latent = modelFS .get_first_stage_encoding (modelFS .encode_first_stage (init_image )) # move to latent space
254
254
255
255
if opt .device != "cpu" :
256
- mem = torch .cuda .memory_allocated () / 1e6
256
+ mem = torch .cuda .memory_allocated (device = opt . device ) / 1e6
257
257
modelFS .to ("cpu" )
258
- while torch .cuda .memory_allocated () / 1e6 >= mem :
258
+ while torch .cuda .memory_allocated (device = opt . device ) / 1e6 >= mem :
259
259
time .sleep (1 )
260
260
261
261
@@ -302,9 +302,9 @@ def load_img(path, h0, w0):
302
302
c = modelCS .get_learned_conditioning (prompts )
303
303
304
304
if opt .device != "cpu" :
305
- mem = torch .cuda .memory_allocated () / 1e6
305
+ mem = torch .cuda .memory_allocated (device = opt . device ) / 1e6
306
306
modelCS .to ("cpu" )
307
- while torch .cuda .memory_allocated () / 1e6 >= mem :
307
+ while torch .cuda .memory_allocated (device = opt . device ) / 1e6 >= mem :
308
308
time .sleep (1 )
309
309
310
310
# encode (scaled latent)
@@ -340,13 +340,13 @@ def load_img(path, h0, w0):
340
340
base_count += 1
341
341
342
342
if opt .device != "cpu" :
343
- mem = torch .cuda .memory_allocated () / 1e6
343
+ mem = torch .cuda .memory_allocated (device = opt . device ) / 1e6
344
344
modelFS .to ("cpu" )
345
- while torch .cuda .memory_allocated () / 1e6 >= mem :
345
+ while torch .cuda .memory_allocated (device = opt . device ) / 1e6 >= mem :
346
346
time .sleep (1 )
347
347
348
348
del samples_ddim
349
- print ("memory_final = " , torch .cuda .memory_allocated () / 1e6 )
349
+ print ("memory_final = " , torch .cuda .memory_allocated (device = opt . device ) / 1e6 )
350
350
351
351
toc = time .time ()
352
352
0 commit comments