ford442 commited on
Commit
5375665
·
verified ·
1 Parent(s): 1ebe661

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -61,7 +61,7 @@ checkpoint = "microsoft/Phi-3.5-mini-instruct"
61
  vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16")
62
  #vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16")
63
 
64
- pipe = StableDiffusion3Pipeline.from_pretrained("ford442/stable-diffusion-3.5-medium-bf16").to(torch.bfloat16)
65
  #pipe = StableDiffusion3Pipeline.from_pretrained("ford442/stable-diffusion-3.5-medium-bf16").to(torch.device("cuda:0"))
66
  #pipe = StableDiffusion3Pipeline.from_pretrained("ford442/RealVis_Medium_1.0b_bf16", torch_dtype=torch.bfloat16)
67
  #pipe = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3.5-medium", token=hftoken, torch_dtype=torch.float32, device_map='balanced')
@@ -117,7 +117,7 @@ def filter_text(text,phraseC):
117
  MAX_SEED = np.iinfo(np.int32).max
118
  MAX_IMAGE_SIZE = 4096
119
 
120
- @spaces.GPU(duration=80)
121
  def infer(
122
  prompt,
123
  negative_prompt,
@@ -132,7 +132,7 @@ def infer(
132
  progress=gr.Progress(track_tqdm=True),
133
  ):
134
  upscaler_2.to(torch.device('cpu'))
135
- pipe.to(torch.device('cuda'))
136
  torch.set_float32_matmul_precision("highest")
137
  seed = random.randint(0, MAX_SEED)
138
  generator = torch.Generator(device='cuda').manual_seed(seed)
 
61
  vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16")
62
  #vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16")
63
 
64
+ pipe = StableDiffusion3Pipeline.from_pretrained("ford442/stable-diffusion-3.5-medium-bf16") #.to(torch.bfloat16)
65
  #pipe = StableDiffusion3Pipeline.from_pretrained("ford442/stable-diffusion-3.5-medium-bf16").to(torch.device("cuda:0"))
66
  #pipe = StableDiffusion3Pipeline.from_pretrained("ford442/RealVis_Medium_1.0b_bf16", torch_dtype=torch.bfloat16)
67
  #pipe = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3.5-medium", token=hftoken, torch_dtype=torch.float32, device_map='balanced')
 
117
  MAX_SEED = np.iinfo(np.int32).max
118
  MAX_IMAGE_SIZE = 4096
119
 
120
+ @spaces.GPU(duration=90)
121
  def infer(
122
  prompt,
123
  negative_prompt,
 
132
  progress=gr.Progress(track_tqdm=True),
133
  ):
134
  upscaler_2.to(torch.device('cpu'))
135
+ pipe.to(device=device, dtype=torch.bfloat16)
136
  torch.set_float32_matmul_precision("highest")
137
  seed = random.randint(0, MAX_SEED)
138
  generator = torch.Generator(device='cuda').manual_seed(seed)