data
GenerationOutput
extends
ModelOutputGenerationOutput(samples: Tensor, intermediates: tuple[Tensor, ...] | None = None)Final result of a generative model's sampling loop.
Attributes
samplesTensorFinal
(n_samples, C, H, W) (image) or (n_samples, T)
(text) batch produced by the sampler.intermediates(tuple[Tensor, ...] or None, optional)Per-step latents / samples — populated only when the caller
passes
return_intermediates=True to generate. Useful for
animating trajectories or debugging schedulers.Notes
Returned by DiffusionMixin.generate and
VAEForImageGeneration.generate. Text generation through
CausalLMMixin.generate currently returns a bare
Tensor rather than this wrapper — that may change.
Examples
>>> model = AutoModelForImageGeneration.from_pretrained("ddpm_cifar_gen")
>>> scheduler = DDPMScheduler(num_train_timesteps=1000)
>>> out = model.generate(scheduler, n_samples=4, num_inference_steps=50)
>>> out.samples.shape
(4, 3, 32, 32)