mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-06-07 21:20:49 +00:00
Made device agnostic
This commit is contained in:
parent
6df316c881
commit
1581d5a167
@ -110,7 +110,8 @@ class LDSR:
|
|||||||
down_sample_method = 'Lanczos'
|
down_sample_method = 'Lanczos'
|
||||||
|
|
||||||
gc.collect()
|
gc.collect()
|
||||||
torch.cuda.empty_cache()
|
if torch.cuda.is_available:
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
im_og = image
|
im_og = image
|
||||||
width_og, height_og = im_og.size
|
width_og, height_og = im_og.size
|
||||||
@ -147,7 +148,9 @@ class LDSR:
|
|||||||
|
|
||||||
del model
|
del model
|
||||||
gc.collect()
|
gc.collect()
|
||||||
torch.cuda.empty_cache()
|
if torch.cuda.is_available:
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
return a
|
return a
|
||||||
|
|
||||||
|
|
||||||
@ -162,7 +165,7 @@ def get_cond(selected_path):
|
|||||||
c = rearrange(c, '1 c h w -> 1 h w c')
|
c = rearrange(c, '1 c h w -> 1 h w c')
|
||||||
c = 2. * c - 1.
|
c = 2. * c - 1.
|
||||||
|
|
||||||
c = c.to(torch.device("cuda"))
|
c = c.to(shared.device)
|
||||||
example["LR_image"] = c
|
example["LR_image"] = c
|
||||||
example["image"] = c_up
|
example["image"] = c_up
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user