MCPcopy Create free account
hub / github.com/easydiffusion/easydiffusion / on_step

Function on_step

ui/easydiffusion/backends/sdkit_common.py:213–234  ·  view source on GitHub ↗
(x_samples, i, *args)

Source from the content-addressed store, hash-verified

211
212def make_step_callback(context, callback):
213 def on_step(x_samples, i, *args):
214 stream_image_progress = opts.get("stream_image_progress", False)
215 stream_image_progress_interval = opts.get("stream_image_progress_interval", 3)
216
217 if context.test_diffusers:
218 context.partial_x_samples = (x_samples, args[0])
219 else:
220 context.partial_x_samples = x_samples
221
222 if stream_image_progress and stream_image_progress_interval > 0 and i % stream_image_progress_interval == 0:
223 if context.test_diffusers:
224 images = diffusers_latent_samples_to_images(context, context.partial_x_samples)
225 else:
226 images = latent_samples_to_images(context, context.partial_x_samples)
227 else:
228 images = None
229
230 if callback:
231 callback(images, i, *args)
232
233 if context.stop_processing:
234 raise UserInitiatedStop("User requested that we stop processing")
235
236 return on_step
237

Callers

nothing calls this directly

Calls 3

UserInitiatedStopClass · 0.90
callbackFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected