Merge pull request #10 from maybleMyers/deev

fix radiance previews
This commit is contained in:
benjimon 2025-08-29 04:36:52 -07:00 committed by GitHub
commit 375f417b3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 3 deletions

View File

@ -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

View File

@ -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