pub struct MultiViewDiffusionPipeline { /* private fields */ }Expand description
The full multi-view diffusion pipeline.
Implementations§
Source§impl MultiViewDiffusionPipeline
impl MultiViewDiffusionPipeline
Sourcepub fn load(
config: DiffusionConfig,
weights_dir: &Path,
device: &Device,
) -> Result<Self, DiffusionError>
pub fn load( config: DiffusionConfig, weights_dir: &Path, device: &Device, ) -> Result<Self, DiffusionError>
Load a pipeline from a directory of safetensors files.
Expected files:
unet/diffusion_pytorch_model.safetensorsvae/diffusion_pytorch_model.safetensorsimage_encoder/model.safetensorsupsampler/diffusion_pytorch_model.safetensors(optional, for SdX2 mode)
Sourcepub fn generate(
&mut self,
reference_image: &Tensor,
normal_map_latents: &Tensor,
camera_poses: &Tensor,
_seed: u64,
) -> Result<MultiViewOutput, DiffusionError>
pub fn generate( &mut self, reference_image: &Tensor, normal_map_latents: &Tensor, camera_poses: &Tensor, _seed: u64, ) -> Result<MultiViewOutput, DiffusionError>
Generate multi-view images from a reference image and camera poses.
reference_image:(1, 3, 224, 224)normalised image for CLIP.normal_map_latents:(num_views, latent_channels, h, w)encoded normal maps.camera_poses:(num_views, pose_dim)flattened extrinsics per view.seed: RNG seed for reproducibility.
§Classifier-Free Guidance (CFG)
This pipeline implements CFG for IP-Adapter conditioning:
- Conditional pass: Uses IP tokens from CLIP-encoded reference image
- Unconditional pass: Skips IP tokens (no reference conditioning)
- Formula:
pred = uncond + guidance_scale * (cond - uncond)
The guidance_scale parameter (from config) controls the strength of
conditioning. Typical values:
1.0= no guidance (unconditional generation)3.0-7.5= balanced (default: 3.0 for GAF)>10.0= strong conditioning (may oversaturate)
§Errors
Returns DiffusionError::Inference if guidance_scale < 1.0 or if any
tensor operation fails during generation.
Auto Trait Implementations§
impl Freeze for MultiViewDiffusionPipeline
impl !RefUnwindSafe for MultiViewDiffusionPipeline
impl Send for MultiViewDiffusionPipeline
impl Sync for MultiViewDiffusionPipeline
impl Unpin for MultiViewDiffusionPipeline
impl UnsafeUnpin for MultiViewDiffusionPipeline
impl !UnwindSafe for MultiViewDiffusionPipeline
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more