CoolFace
Datasetpublic

diffusers/community-pipelines-mirror

Community Pipeline Examples For more information about community pipelines, please have a look at this issue. Community pipeline examples consist pipelines that have been added by the community. Please have a look at the following tables to get an overview of all community examples. Click on the Code Example to get a copy-and-paste ready code example that you can try out. If a community pipeline doesn't work as expected, please open an issue and ping the author on it. Please… See the full description on the dataset page: https://huggingface.co/datasets/diffusers/community-pipelines-mirror.

sourceHugging Faceupdated 29d agoView on Hugging Face
9likes22kdownloads
one_step_unet.py25 linesDownload Raw Back to root
1#!/usr/bin/env python32import torch3 4from diffusers import DiffusionPipeline5 6 7class UnetSchedulerOneForwardPipeline(DiffusionPipeline):8    def __init__(self, unet, scheduler):9        super().__init__()10 11        self.register_modules(unet=unet, scheduler=scheduler)12 13    def __call__(self):14        image = torch.randn(15            (1, self.unet.config.in_channels, self.unet.config.sample_size, self.unet.config.sample_size),16        )17        timestep = 118 19        model_output = self.unet(image, timestep).sample20        scheduler_output = self.scheduler.step(model_output, timestep, image).prev_sample21 22        result = scheduler_output - scheduler_output + torch.ones_like(scheduler_output)23 24        return result25