Skip to content

Instantly share code, notes, and snippets.

View roessland's full-sized avatar
🎯
Focusing

Andreas Røssland roessland

🎯
Focusing
View GitHub Profile
@trygvebw
trygvebw / find_noise.py
Last active March 11, 2024 12:50
A "reverse" version of the k_euler sampler for Stable Diffusion, which finds the noise that will reconstruct the supplied image
import torch
import numpy as np
import k_diffusion as K
from PIL import Image
from torch import autocast
from einops import rearrange, repeat
def pil_img_to_torch(pil_img, half=False):
image = np.array(pil_img).astype(np.float32) / 255.0
" To get a list of Actions run `:actionlist `
" let mapleader = ','
" let mapleader = " "
let mapleader = "\<SPACE>"
set ignorecase smartcase
set NERDTree
set hlsearch
set showmode
set scrolloff=5