badayvedat commited on
Commit
b098573
1 Parent(s): c7ded68

fix: dtype for cpu

Browse files
Files changed (1) hide show
  1. model.py +3 -2
model.py CHANGED
@@ -6,6 +6,7 @@ def get_pipeline():
6
  from diffusers import AutoencoderTiny, AutoPipelineForImage2Image
7
 
8
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
 
9
 
10
  pipe = AutoPipelineForImage2Image.from_pretrained(
11
  "SimianLuo/LCM_Dreamshaper_v7",
@@ -13,10 +14,10 @@ def get_pipeline():
13
  )
14
  pipe.vae = AutoencoderTiny.from_pretrained(
15
  "madebyollin/taesd",
16
- torch_dtype=torch.float16,
17
  use_safetensors=True,
18
  )
19
- pipe = pipe.to(device, dtype=torch.float16)
20
  pipe.unet.to(memory_format=torch.channels_last)
21
  return pipe
22
 
 
6
  from diffusers import AutoencoderTiny, AutoPipelineForImage2Image
7
 
8
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
9
+ torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
10
 
11
  pipe = AutoPipelineForImage2Image.from_pretrained(
12
  "SimianLuo/LCM_Dreamshaper_v7",
 
14
  )
15
  pipe.vae = AutoencoderTiny.from_pretrained(
16
  "madebyollin/taesd",
17
+ torch_dtype=torch_dtype,
18
  use_safetensors=True,
19
  )
20
+ pipe = pipe.to(device, dtype=torch_dtype)
21
  pipe.unet.to(memory_format=torch.channels_last)
22
  return pipe
23