This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler | |
import torch | |
scheduler = EulerDiscreteScheduler(use_karras_sigmas=True) | |
pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5",scheduler=scheduler, torch_dtype=torch.float16) | |
generator = torch.Generator("cuda").manual_seed(0) | |
pipe = pipe.to('cuda') | |
image = pipe("a golden retriever",num_inference_steps=30,generator=generator).images[0] | |
image.save('test.jpg') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import torch | |
import fire | |
import glob | |
def abs_ind_to_feat_file(abs_ind, cum_sz, feat_files): | |
inds = np.argwhere(abs_ind - cum_sz >= 0) | |
last_ind = inds[-1].item() | |
ind_offset = cum_sz[last_ind] | |
local_ind = abs_ind - ind_offset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"model": { | |
"type": "image_v1", | |
"input_channels": 3, | |
"input_size": [64, 64], | |
"mapping_out": 256, | |
"depths": [2, 2, 4, 4], | |
"channels": [128, 256, 256, 512], | |
"self_attn_depths": [false, false, true, true], | |
"dropout_rate": 0.05, |