Spaces:
Runtime error
Runtime error
RohitGandikota
commited on
Commit
β’
9ab9acf
1
Parent(s):
675f687
fixing inference
Browse files
app.py
CHANGED
@@ -40,7 +40,7 @@ class Demo:
|
|
40 |
self.device = 'cuda'
|
41 |
self.weight_dtype = torch.float16
|
42 |
self.pipe = StableDiffusionXLPipeline.from_pretrained('stabilityai/stable-diffusion-xl-base-1.0', torch_dtype=self.weight_dtype).to(self.device)
|
43 |
-
|
44 |
with gr.Blocks() as demo:
|
45 |
self.layout()
|
46 |
demo.queue().launch(share=True, max_threads=3)
|
@@ -280,10 +280,6 @@ class Demo:
|
|
280 |
alpha = 1
|
281 |
if 'rank' in model_path:
|
282 |
rank = int(model_path.split('_')[-1].replace('.pt',''))
|
283 |
-
# if 'rank4' in model_path:
|
284 |
-
# rank = 4
|
285 |
-
# if 'rank8' in model_path:
|
286 |
-
# rank = 8
|
287 |
if 'alpha1' in model_path:
|
288 |
alpha = 1.0
|
289 |
network = LoRANetwork(
|
@@ -297,7 +293,7 @@ class Demo:
|
|
297 |
|
298 |
|
299 |
generator = torch.manual_seed(seed)
|
300 |
-
edited_image = self.pipe(prompt, num_images_per_prompt=1, num_inference_steps=50, generator=generator, network=network, start_noise=start_noise, scale=scale, unet=unet).images[0]
|
301 |
|
302 |
generator = torch.manual_seed(seed)
|
303 |
original_image = self.pipe(prompt, num_images_per_prompt=1, num_inference_steps=50, generator=generator, network=network, start_noise=start_noise, scale=0, unet=unet).images[0]
|
|
|
40 |
self.device = 'cuda'
|
41 |
self.weight_dtype = torch.float16
|
42 |
self.pipe = StableDiffusionXLPipeline.from_pretrained('stabilityai/stable-diffusion-xl-base-1.0', torch_dtype=self.weight_dtype).to(self.device)
|
43 |
+
self.pipe.enable_xformers_memory_efficient_attention()
|
44 |
with gr.Blocks() as demo:
|
45 |
self.layout()
|
46 |
demo.queue().launch(share=True, max_threads=3)
|
|
|
280 |
alpha = 1
|
281 |
if 'rank' in model_path:
|
282 |
rank = int(model_path.split('_')[-1].replace('.pt',''))
|
|
|
|
|
|
|
|
|
283 |
if 'alpha1' in model_path:
|
284 |
alpha = 1.0
|
285 |
network = LoRANetwork(
|
|
|
293 |
|
294 |
|
295 |
generator = torch.manual_seed(seed)
|
296 |
+
edited_image = self.pipe(prompt, num_images_per_prompt=1, num_inference_steps=50, generator=generator, network=network, start_noise=int(start_noise), scale=float(scale), unet=unet).images[0]
|
297 |
|
298 |
generator = torch.manual_seed(seed)
|
299 |
original_image = self.pipe(prompt, num_images_per_prompt=1, num_inference_steps=50, generator=generator, network=network, start_noise=start_noise, scale=0, unet=unet).images[0]
|