Skip to content

Instantly share code, notes, and snippets.

@jochemstoel
Forked from maxim04/inference.py
Created February 1, 2023 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jochemstoel/915d6a92b473cb01fce7a47e22d4ce94 to your computer and use it in GitHub Desktop.
Save jochemstoel/915d6a92b473cb01fce7a47e22d4ce94 to your computer and use it in GitHub Desktop.
import os
import torch
from torch import autocast
from diffusers import StableDiffusionPipeline, DDIMScheduler
model_path = os.getenv('WEIGHTS_DIR')
scheduler = DDIMScheduler(beta_start=0.00085, beta_end=0.012, beta_schedule="scaled_linear", clip_sample=False, set_alpha_to_one=False)
pipe = StableDiffusionPipeline.from_pretrained(model_path, scheduler=scheduler, safety_checker=None, torch_dtype=torch.float16).to("cuda")
g_cuda = None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment