Commit
·
3e9f5ce
1
Parent(s):
a3ecce8
up
Browse files- run_local_xl.py +1 -1
- run_local_xl_inpaint.py +5 -3
- run_xl_ediffi.py +3 -3
run_local_xl.py
CHANGED
|
@@ -17,7 +17,7 @@ api = HfApi()
|
|
| 17 |
start_time = time.time()
|
| 18 |
|
| 19 |
use_refiner = bool(int(sys.argv[1]))
|
| 20 |
-
use_diffusers =
|
| 21 |
|
| 22 |
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16, force_upcast=True)
|
| 23 |
if use_diffusers:
|
|
|
|
| 17 |
start_time = time.time()
|
| 18 |
|
| 19 |
use_refiner = bool(int(sys.argv[1]))
|
| 20 |
+
use_diffusers = False
|
| 21 |
|
| 22 |
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16, force_upcast=True)
|
| 23 |
if use_diffusers:
|
run_local_xl_inpaint.py
CHANGED
|
@@ -42,15 +42,17 @@ if use_refiner:
|
|
| 42 |
# refiner.enable_sequential_cpu_offload()
|
| 43 |
|
| 44 |
prompt = "A majestic tiger sitting on a bench"
|
| 45 |
-
steps =
|
| 46 |
seed = 3
|
|
|
|
|
|
|
| 47 |
seed_everything(seed)
|
| 48 |
start_time = time.time()
|
| 49 |
-
image = pipe(prompt=prompt, image=init_image, mask_image=mask_image, num_inference_steps=steps, denoising_end=
|
| 50 |
print(time.time() - start_time)
|
| 51 |
|
| 52 |
if use_refiner:
|
| 53 |
-
image = refiner(prompt=prompt, image=image, mask_image=mask_image, num_inference_steps=steps, denoising_start=
|
| 54 |
|
| 55 |
file_name = f"aaa_1"
|
| 56 |
path = os.path.join(Path.home(), "images", "ediffi_sdxl", f"{file_name}.png")
|
|
|
|
| 42 |
# refiner.enable_sequential_cpu_offload()
|
| 43 |
|
| 44 |
prompt = "A majestic tiger sitting on a bench"
|
| 45 |
+
steps = 50
|
| 46 |
seed = 3
|
| 47 |
+
denoising_end = None
|
| 48 |
+
|
| 49 |
seed_everything(seed)
|
| 50 |
start_time = time.time()
|
| 51 |
+
image = pipe(prompt=prompt, image=init_image, mask_image=mask_image, num_inference_steps=steps, denoising_end=denoising_end, strength=0.80, output_type="latent").images
|
| 52 |
print(time.time() - start_time)
|
| 53 |
|
| 54 |
if use_refiner:
|
| 55 |
+
image = refiner(prompt=prompt, image=image, mask_image=mask_image, num_inference_steps=steps, denoising_start=denoising_end).images[0]
|
| 56 |
|
| 57 |
file_name = f"aaa_1"
|
| 58 |
path = os.path.join(Path.home(), "images", "ediffi_sdxl", f"{file_name}.png")
|
run_xl_ediffi.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
-
from diffusers import DiffusionPipeline, EulerDiscreteScheduler, StableDiffusionPipeline, KDPM2DiscreteScheduler, StableDiffusionImg2ImgPipeline, HeunDiscreteScheduler, KDPM2AncestralDiscreteScheduler, DDIMScheduler
|
| 3 |
from diffusers import DiffusionPipeline
|
| 4 |
import time
|
| 5 |
from pytorch_lightning import seed_everything
|
|
@@ -21,11 +21,11 @@ start_time = time.time()
|
|
| 21 |
model_id = "stabilityai/stable-diffusion-xl-base-0.9"
|
| 22 |
model_id = "runwayml/stable-diffusion-v1-5"
|
| 23 |
pipe_high_noise = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16, variant="fp16", use_safetensors=True, local_files_only=True)
|
| 24 |
-
pipe_high_noise.scheduler =
|
| 25 |
pipe_high_noise.to("cuda")
|
| 26 |
|
| 27 |
pipe_low_noise = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-0.9", torch_dtype=torch.float16, use_safetensors=True, variant="fp16")
|
| 28 |
-
pipe_low_noise.scheduler =
|
| 29 |
pipe_low_noise.to("cuda")
|
| 30 |
|
| 31 |
prompt = "A majestic lion jumping from a big stone at night"
|
|
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
+
from diffusers import DiffusionPipeline, EulerDiscreteScheduler, StableDiffusionPipeline, KDPM2DiscreteScheduler, StableDiffusionImg2ImgPipeline, HeunDiscreteScheduler, KDPM2AncestralDiscreteScheduler, DDIMScheduler, HeunDiscreteScheduler, DEISMultistepScheduler
|
| 3 |
from diffusers import DiffusionPipeline
|
| 4 |
import time
|
| 5 |
from pytorch_lightning import seed_everything
|
|
|
|
| 21 |
model_id = "stabilityai/stable-diffusion-xl-base-0.9"
|
| 22 |
model_id = "runwayml/stable-diffusion-v1-5"
|
| 23 |
pipe_high_noise = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16, variant="fp16", use_safetensors=True, local_files_only=True)
|
| 24 |
+
pipe_high_noise.scheduler = DEISMultistepScheduler.from_config(pipe_high_noise.scheduler.config)
|
| 25 |
pipe_high_noise.to("cuda")
|
| 26 |
|
| 27 |
pipe_low_noise = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-0.9", torch_dtype=torch.float16, use_safetensors=True, variant="fp16")
|
| 28 |
+
pipe_low_noise.scheduler = DEISMultistepScheduler.from_config(pipe_low_noise.scheduler.config)
|
| 29 |
pipe_low_noise.to("cuda")
|
| 30 |
|
| 31 |
prompt = "A majestic lion jumping from a big stone at night"
|