Skip to main content

VisionTower

Struct VisionTower 

Source
pub struct VisionTower { /* private fields */ }

Implementations§

Source§

impl VisionTower

Source

pub fn load(e: &Engine, dir: &Path) -> Result<Self, Box<dyn Error>>

Load the tower from a directory containing outside.safetensors.

Source

pub fn forward( &self, e: &Engine, patches: &[f32], gh: usize, gw: usize, ) -> Result<CudaSlice<f32>, Box<dyn Error>>

Forward one image’s patches -> [ghgw/4, 5120] merged embeddings (device). patches is host [ghgw, 1536] in the preprocessor’s (c, t, ph, pw) flat order.

Source

pub fn forward_seq( &self, e: &Engine, patches: &[f32], groups: usize, gh: usize, gw: usize, ) -> Result<CudaSlice<f32>, Box<dyn Error>>

Forward groups temporal groups of one video (or a single image at groups=1): host patches [groupsghgw, 1536], frame-major -> [groupsghgw/4, 5120] merged embeddings, frame-major. HF cu_seqlens law (vision_utils.get_vision_cu_seqlens, merge_temporal=False — the qwen2_vl/qwen3_vl/qwen3_5 convention): EACH temporal group is its own attention segment, and pos table / rope / merger are all frame-local too — so a video is exactly its groups run through the single-image forward, concatenated. (Joint clip attention is the kimi_k25 convention only; parity receipt: joint span scored mean_cos 0.92 vs the HF oracle, per-group 1.0.)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.