Manjushri commited on
Commit
e4d9c14
1 Parent(s): e8b5fd4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -8,7 +8,7 @@ if torch.cuda.is_available():
8
  PYTORCH_CUDA_ALLOC_CONF={'max_split_size_mb': 6000}
9
  torch.cuda.max_memory_allocated(device=device)
10
  torch.cuda.empty_cache()
11
- pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True)
12
  pipe.enable_xformers_memory_efficient_attention()
13
  pipe = pipe.to(device)
14
  pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
@@ -18,7 +18,7 @@ if torch.cuda.is_available():
18
  refiner.enable_sequential_cpu_offload()
19
  refiner.unet = torch.compile(refiner.unet, mode="reduce-overhead", fullgraph=True)
20
  else:
21
- pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", use_safetensors=True)
22
  pipe = pipe.to(device)
23
  pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
24
  refiner = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-1.0", use_safetensors=True)
@@ -27,7 +27,7 @@ else:
27
 
28
  def genie (prompt, negative_prompt, height, width, scale, steps, seed, prompt_2, negative_prompt_2, high_noise_frac):
29
  generator = np.random.seed(0) if seed == 0 else torch.manual_seed(seed)
30
- int_image = pipe(prompt, prompt_2=prompt_2, negative_prompt_2=negative_prompt_2, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale, num_images_per_prompt=1, generator=generator, output_type="latent").images
31
  image = refiner(prompt=prompt, prompt_2=prompt_2, negative_prompt=negative_prompt, negative_prompt_2=negative_prompt_2, image=int_image, denoising_start=high_noise_frac).images[0]
32
  return image
33
 
 
8
  PYTORCH_CUDA_ALLOC_CONF={'max_split_size_mb': 6000}
9
  torch.cuda.max_memory_allocated(device=device)
10
  torch.cuda.empty_cache()
11
+ pipe = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo", torch_dtype=torch.float16, variant="fp16", use_safetensors=True)
12
  pipe.enable_xformers_memory_efficient_attention()
13
  pipe = pipe.to(device)
14
  pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
 
18
  refiner.enable_sequential_cpu_offload()
19
  refiner.unet = torch.compile(refiner.unet, mode="reduce-overhead", fullgraph=True)
20
  else:
21
+ pipe = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo", use_safetensors=True)
22
  pipe = pipe.to(device)
23
  pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
24
  refiner = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-1.0", use_safetensors=True)
 
27
 
28
  def genie (prompt, negative_prompt, height, width, scale, steps, seed, prompt_2, negative_prompt_2, high_noise_frac):
29
  generator = np.random.seed(0) if seed == 0 else torch.manual_seed(seed)
30
+ int_image = pipe(prompt, prompt_2=prompt_2, height=height, width=width, num_inference_steps=steps, num_images_per_prompt=1, generator=generator, output_type="latent").images
31
  image = refiner(prompt=prompt, prompt_2=prompt_2, negative_prompt=negative_prompt, negative_prompt_2=negative_prompt_2, image=int_image, denoising_start=high_noise_frac).images[0]
32
  return image
33