Downloads · 30 days
47
2% of all-time downloads
hansyan/perflow-sd15-delta-weights
perflow-sd15-delta-weights is a machine learning model from hansyan. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for diffusers. The card lists the license as cc-by-nc-4.0.
Github repo: https://github.com/magic-research/piecewise-rectified-flow <br
Downloads · 30 days
47
2% of all-time downloads
All-time downloads
3K
Public
Repo size
6.9 GB
Likes
5
Public
Click a slice to open those files.
.safetensors3.4 GB · 100%
From the Hugging Face model README
Github repo: https://github.com/magic-research/piecewise-rectified-flow <br>
Project page: https://piecewise-rectified-flow.github.io/
Demo:
import torch, torchvision
from diffusers import StableDiffusionPipeline, UNet2DConditionModel
from src.utils_perflow import merge_delta_weights_into_unet
from src.scheduler_perflow import PeRFlowScheduler
delta_weights = UNet2DConditionModel.from_pretrained("hansyan/perflow-sd15-delta-weights", torch_dtype=torch.float16, variant="v0-1",).state_dict()
pipe = StableDiffusionPipeline.from_pretrained("Lykon/dreamshaper-8", torch_dtype=torch.float16,)
pipe = merge_delta_weights_into_unet(pipe, delta_weights)
pipe.scheduler = PeRFlowScheduler.from_config(pipe.scheduler.config, prediction_type="epsilon", num_time_windows=4)
pipe.to("cuda", torch.float16)
prompts_list = ["A man with brown skin, a beard, and dark eyes", "A colorful bird standing on the tree, open beak",]
for i, prompt in enumerate(prompts_list):
generator = torch.Generator("cuda").manual_seed(1024)
prompt = "RAW photo, 8k uhd, dslr, high quality, film grain, highly detailed, masterpiece; " + prompt
neg_prompt = "distorted, blur, smooth, low-quality, warm, haze, over-saturated, high-contrast, out of focus, dark"
samples = pipe(
prompt = [prompt] * 8,
negative_prompt = [neg_prompt] * 8,
height = 512,
width = 512,
num_inference_steps = 8,
guidance_scale = 7.5,
generator = generator,
output_type = 'pt',
).images
torchvision.utils.save_image(torchvision.utils.make_grid(samples, nrow=4), f"tmp_{i}.png")