mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-06-21 21:14:23 +08:00
commit
375f417b3f
@ -50,6 +50,8 @@ Donate to Lodestone (training is bookoo expensive and crowdfunded): https://ko-f
|
||||
Discord: http://discord.gg/SQVcWVbqKx
|
||||
|
||||
## Changlog
|
||||
8/29/2025
|
||||
Fixed previews w/ radiance chroma models, fixed memory management and offloading mechanisms for radiance.
|
||||
8/28/2025
|
||||
Added initial support for the radiance model class.
|
||||
7/13/2025
|
||||
|
||||
@ -37,7 +37,15 @@ approximation_indexes = {"Full": 0, "Approx NN": 1, "Approx cheap": 2, "TAESD":
|
||||
|
||||
|
||||
def samples_to_images_tensor(sample, approximation=None, model=None):
|
||||
"""Transforms 4-channel latent space images into 3-channel RGB image tensors, with values in range [-1, 1]."""
|
||||
"""Transforms latent/pixel space tensors into RGB image tensors, with values in range [-1, 1]."""
|
||||
|
||||
if model is None:
|
||||
model = shared.sd_model
|
||||
|
||||
# Handle ChromaDCT models that work in pixel space
|
||||
if hasattr(model, '__class__') and 'ChromaDCT' in model.__class__.__name__:
|
||||
# ChromaDCT outputs are already in pixel space (B, 3, H, W) with range [-1, 1]
|
||||
return sample.clamp(-1.0, 1.0)
|
||||
|
||||
if approximation is None or (shared.state.interrupted and opts.live_preview_fast_interrupt):
|
||||
approximation = approximation_indexes.get(opts.show_progress_type, 0)
|
||||
@ -60,8 +68,6 @@ def samples_to_images_tensor(sample, approximation=None, model=None):
|
||||
x_sample = m(sample.to(devices.device, devices.dtype)).detach()
|
||||
x_sample = x_sample * 2 - 1
|
||||
else:
|
||||
if model is None:
|
||||
model = shared.sd_model
|
||||
x_sample = model.decode_first_stage(sample)
|
||||
|
||||
return x_sample
|
||||
|
||||
Loading…
Reference in New Issue
Block a user