Spaces:
Runtime error
Runtime error
File size: 1,035 Bytes
2de3774 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
import torch
import os
import einops
from latent_preview import Latent2RGBPreviewer
import numpy as np
def clean_prompt_cond_caches():
conditions = {}
conditions["+"] = {}
conditions["-"] = {}
conditions["switch"] = {}
conditions["+"]["text"] = None
conditions["+"]["cache"] = None
conditions["-"]["text"] = None
conditions["-"]["cache"] = None
conditions["switch"]["text"] = None
conditions["switch"]["cache"] = None
return conditions
def set_timestep_range(conditioning, start, end):
c = []
for t in conditioning:
n = [t[0], t[1].copy()]
if "pooled_output" in n[1]:
n[1]["start_percent"] = start
n[1]["end_percent"] = end
c.append(n)
return c
def get_previewer(device, latent_format):
previewer = Latent2RGBPreviewer(latent_format.latent_rgb_factors)
def preview_function(x0, step, total_steps):
return previewer.decode_latent_to_preview(x0)
previewer.preview = preview_function
return previewer
|