ruslanmv commited on
Commit
fabbe1e
1 Parent(s): 28ad340

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +9 -5
main.py CHANGED
@@ -67,9 +67,13 @@ SECRET_TOKEN = os.getenv("SECRET_TOKEN", "default_secret")
67
  if is_gpu:
68
  # Uncomment the following line if you want to enable CUDA launch blocking
69
  os.environ["CUDA_LAUNCH_BLOCKING"] = "1"
 
 
70
  else:
71
  # Uncomment the following line if you want to use CPU instead of GPU
72
  device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
 
 
73
 
74
 
75
  # Get the current directory
@@ -82,17 +86,17 @@ cache_path = os.path.join(current_dir, "cache")
82
  if not SSD_1B:
83
 
84
  unet = UNet2DConditionModel.from_pretrained(
85
- "latent-consistency/lcm-sdxl",
86
- torch_dtype=torch.float16,
87
- variant="fp16",
88
  cache_dir=cache_path,
89
  )
90
  pipe = DiffusionPipeline.from_pretrained(
91
  # "stabilityai/stable-diffusion-xl-base-1.0",
92
  "stabilityai/sdxl-turbo",
93
  unet=unet,
94
- torch_dtype=torch.float16,
95
- variant="fp16",
96
  cache_dir=cache_path,
97
  )
98
 
 
67
  if is_gpu:
68
  # Uncomment the following line if you want to enable CUDA launch blocking
69
  os.environ["CUDA_LAUNCH_BLOCKING"] = "1"
70
+ torch_dtype=torch.float16
71
+ variant="fp16"
72
  else:
73
  # Uncomment the following line if you want to use CPU instead of GPU
74
  device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
75
+ torch_dtype=torch.float32
76
+ variant="fp32"
77
 
78
 
79
  # Get the current directory
 
86
  if not SSD_1B:
87
 
88
  unet = UNet2DConditionModel.from_pretrained(
89
+ "latent-consistency/lcm-sdxl",
90
+ torch_dtype=torch_dtype,
91
+ variant=variant,
92
  cache_dir=cache_path,
93
  )
94
  pipe = DiffusionPipeline.from_pretrained(
95
  # "stabilityai/stable-diffusion-xl-base-1.0",
96
  "stabilityai/sdxl-turbo",
97
  unet=unet,
98
+ torch_dtype=torch_dtype,
99
+ variant=variant,
100
  cache_dir=cache_path,
101
  )
102