1inkusFace commited on
Commit
723e0d8
·
verified ·
1 Parent(s): e135f8e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -267,7 +267,7 @@ device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
267
 
268
  #accelerator = Accelerator(mixed_precision="bf16") # Example
269
 
270
- upscaler = UpscaleWithModel.from_pretrained("Kim2091/ClearRealityV1").to(torch.device("cuda:0"))
271
 
272
  def load_and_prepare_model():
273
  #sched = EulerAncestralDiscreteScheduler.from_pretrained('ford442/RealVisXL_V5.0_BF16', subfolder='scheduler',beta_schedule="scaled_linear", beta_start=0.00085, beta_end=0.012, steps_offset=1 ,use_karras_sigmas=True)
@@ -290,7 +290,8 @@ def load_and_prepare_model():
290
  print(f'init noise scale: {pipe.scheduler.init_noise_sigma}')
291
  pipe.watermark=None
292
  pipe.safety_checker=None
293
- pipe.to(torch.device('cuda:0'), torch.bfloat16)
 
294
  pipe.vae = vaeXL #.to(torch.bfloat16)
295
  #pipe.to(torch.bfloat16)
296
  #pipe.to(accelerator.device)
@@ -318,7 +319,7 @@ def load_and_prepare_model():
318
  pipe = load_and_prepare_model()
319
  neg_prompt_2 = " 'non-photorealistic':1.5, 'unrealistic skin','unattractive face':1.3, 'low quality':1.1, ('dull color scheme', 'dull colors', 'digital noise':1.2),'amateurish', 'poorly drawn face':1.3, 'poorly drawn', 'distorted face', 'low resolution', 'simplistic' "
320
 
321
- @spaces.GPU(duration=40)
322
  def generate_30(
323
  prompt: str,
324
  negative_prompt: str = "",
@@ -376,7 +377,7 @@ def generate_30(
376
  os.symlink(sd_image_path, unique_name)
377
  return [unique_name]
378
 
379
- @spaces.GPU(duration=70)
380
  def generate_60(
381
  prompt: str,
382
  negative_prompt: str = "",
@@ -434,7 +435,7 @@ def generate_60(
434
  os.symlink(sd_image_path, unique_name)
435
  return [unique_name]
436
 
437
- @spaces.GPU(duration=100)
438
  def generate_90(
439
  prompt: str,
440
  negative_prompt: str = "",
 
267
 
268
  #accelerator = Accelerator(mixed_precision="bf16") # Example
269
 
270
+ upscaler = UpscaleWithModel.from_pretrained("Kim2091/ClearRealityV1").to(device)
271
 
272
  def load_and_prepare_model():
273
  #sched = EulerAncestralDiscreteScheduler.from_pretrained('ford442/RealVisXL_V5.0_BF16', subfolder='scheduler',beta_schedule="scaled_linear", beta_start=0.00085, beta_end=0.012, steps_offset=1 ,use_karras_sigmas=True)
 
290
  print(f'init noise scale: {pipe.scheduler.init_noise_sigma}')
291
  pipe.watermark=None
292
  pipe.safety_checker=None
293
+ #pipe.to(torch.device('cuda:0'), torch.bfloat16)
294
+ pipe.to(torch.float16)
295
  pipe.vae = vaeXL #.to(torch.bfloat16)
296
  #pipe.to(torch.bfloat16)
297
  #pipe.to(accelerator.device)
 
319
  pipe = load_and_prepare_model()
320
  neg_prompt_2 = " 'non-photorealistic':1.5, 'unrealistic skin','unattractive face':1.3, 'low quality':1.1, ('dull color scheme', 'dull colors', 'digital noise':1.2),'amateurish', 'poorly drawn face':1.3, 'poorly drawn', 'distorted face', 'low resolution', 'simplistic' "
321
 
322
+ #@spaces.GPU(duration=40)
323
  def generate_30(
324
  prompt: str,
325
  negative_prompt: str = "",
 
377
  os.symlink(sd_image_path, unique_name)
378
  return [unique_name]
379
 
380
+ #@spaces.GPU(duration=70)
381
  def generate_60(
382
  prompt: str,
383
  negative_prompt: str = "",
 
435
  os.symlink(sd_image_path, unique_name)
436
  return [unique_name]
437
 
438
+ #@spaces.GPU(duration=100)
439
  def generate_90(
440
  prompt: str,
441
  negative_prompt: str = "",