pub struct MultiViewSpatialTransformer { /* private fields */ }Expand description
A spatial transformer that includes multi-view attention in every block.
Replaces the standard SpatialTransformer from SD 2.1.
Implementations§
Source§impl MultiViewSpatialTransformer
impl MultiViewSpatialTransformer
Sourcepub fn new(
vs: VarBuilder<'_>,
in_channels: usize,
n_heads: usize,
d_head: usize,
depth: usize,
context_dim: usize,
ip_dim: usize,
num_views: usize,
num_groups: usize,
use_linear_projection: bool,
) -> Result<Self>
pub fn new( vs: VarBuilder<'_>, in_channels: usize, n_heads: usize, d_head: usize, depth: usize, context_dim: usize, ip_dim: usize, num_views: usize, num_groups: usize, use_linear_projection: bool, ) -> Result<Self>
Create a new multi-view spatial transformer with standard attention.
Sourcepub fn new_with_flash(
vs: VarBuilder<'_>,
in_channels: usize,
n_heads: usize,
d_head: usize,
depth: usize,
context_dim: usize,
ip_dim: usize,
num_views: usize,
num_groups: usize,
use_linear_projection: bool,
use_flash_attention: bool,
flash_block_size: usize,
) -> Result<Self>
pub fn new_with_flash( vs: VarBuilder<'_>, in_channels: usize, n_heads: usize, d_head: usize, depth: usize, context_dim: usize, ip_dim: usize, num_views: usize, num_groups: usize, use_linear_projection: bool, use_flash_attention: bool, flash_block_size: usize, ) -> Result<Self>
Create a new multi-view spatial transformer with optional flash attention.
§Arguments
vs- Variable builder for weight initializationin_channels- Number of input channelsn_heads- Number of attention headsd_head- Dimension per headdepth- Number of transformer blockscontext_dim- Text cross-attention context dimensionip_dim- IP-adapter context dimensionnum_views- Number of views for cross-view attentionnum_groups- Number of groups for group normalizationuse_linear_projection- Whether to use linear projectionuse_flash_attention- Whether to use flash attentionflash_block_size- Block size for flash attention tiling
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MultiViewSpatialTransformer
impl !RefUnwindSafe for MultiViewSpatialTransformer
impl Send for MultiViewSpatialTransformer
impl Sync for MultiViewSpatialTransformer
impl Unpin for MultiViewSpatialTransformer
impl UnsafeUnpin for MultiViewSpatialTransformer
impl !UnwindSafe for MultiViewSpatialTransformer
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