Instructions to use Xingyu-Zheng/MrFlow with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use Xingyu-Zheng/MrFlow with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("Xingyu-Zheng/MrFlow", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
| from contextlib import contextmanager | |
| from types import MethodType | |
| import torch | |
| def direct_sigma_schedule(scheduler, first_sigma, steps, device): | |
| original = scheduler.set_timesteps | |
| force_device = device | |
| def set_timesteps(self, sigmas=None, device=None, **kwargs): | |
| _ = sigmas | |
| target_device = device or force_device | |
| sigmas = torch.linspace(first_sigma, 0.0, steps + 1, device=target_device) | |
| self.num_inference_steps = steps | |
| self.timesteps = sigmas[:-1] * self.config.num_train_timesteps | |
| self.sigmas = sigmas | |
| self._step_index = None | |
| self._begin_index = None | |
| if hasattr(self, "set_begin_index"): | |
| self.set_begin_index(0) | |
| scheduler.set_timesteps = MethodType(set_timesteps, scheduler) | |
| try: | |
| yield | |
| finally: | |
| scheduler.set_timesteps = original | |