2023-06-23 06:14:12 +00:00
|
|
|
|
|
|
|
class LatentFormat:
|
2023-09-16 16:59:54 +00:00
|
|
|
scale_factor = 1.0
|
|
|
|
latent_rgb_factors = None
|
|
|
|
taesd_decoder_name = None
|
|
|
|
|
2023-06-23 06:14:12 +00:00
|
|
|
def process_in(self, latent):
|
|
|
|
return latent * self.scale_factor
|
|
|
|
|
|
|
|
def process_out(self, latent):
|
|
|
|
return latent / self.scale_factor
|
|
|
|
|
|
|
|
class SD15(LatentFormat):
|
|
|
|
def __init__(self, scale_factor=0.18215):
|
|
|
|
self.scale_factor = scale_factor
|
2023-06-25 06:38:14 +00:00
|
|
|
self.latent_rgb_factors = [
|
|
|
|
# R G B
|
2023-07-09 17:59:09 +00:00
|
|
|
[ 0.3512, 0.2297, 0.3227],
|
|
|
|
[ 0.3250, 0.4974, 0.2350],
|
|
|
|
[-0.2829, 0.1762, 0.2721],
|
|
|
|
[-0.2120, -0.2616, -0.7177]
|
2023-06-25 06:38:14 +00:00
|
|
|
]
|
2023-10-10 04:21:44 +00:00
|
|
|
self.taesd_decoder_name = "taesd_decoder"
|
2023-06-23 06:14:12 +00:00
|
|
|
|
|
|
|
class SDXL(LatentFormat):
|
|
|
|
def __init__(self):
|
|
|
|
self.scale_factor = 0.13025
|
2023-07-10 14:28:38 +00:00
|
|
|
self.latent_rgb_factors = [
|
2023-06-25 06:38:14 +00:00
|
|
|
# R G B
|
2023-07-09 17:59:09 +00:00
|
|
|
[ 0.3920, 0.4054, 0.4549],
|
|
|
|
[-0.2634, -0.0196, 0.0653],
|
|
|
|
[ 0.0568, 0.1687, -0.0755],
|
|
|
|
[-0.3112, -0.2359, -0.2076]
|
2023-06-25 06:38:14 +00:00
|
|
|
]
|
2023-10-10 04:21:44 +00:00
|
|
|
self.taesd_decoder_name = "taesdxl_decoder"
|
2024-01-03 08:30:39 +00:00
|
|
|
|
|
|
|
class SD_X4(LatentFormat):
|
|
|
|
def __init__(self):
|
|
|
|
self.scale_factor = 0.08333
|