pub struct MediaEncoder {
pub text: EmbeddingGemma2,
pub proc: VisionProcessor,
pub ids: SpecialIds,
/* private fields */
}Expand description
The text encoder with the vision and audio towers beside it (each loaded on first use).
Fields§
§text: EmbeddingGemma2§proc: VisionProcessor§ids: SpecialIdsImplementations§
Source§impl MediaEncoder
impl MediaEncoder
pub fn load( model: &Arc<CmfModel>, pool: Option<Arc<Pool>>, ) -> Result<Self, String>
Sourcepub fn has_vision(&self) -> bool
pub fn has_vision(&self) -> bool
Does the file carry the vision tower?
Sourcepub fn vision(&self) -> Result<&VisionTower, String>
pub fn vision(&self) -> Result<&VisionTower, String>
The vision tower, loaded on first use (~0.7 GB of f32 weights).
Sourcepub fn warm_vision(&self) -> Result<(), String>
pub fn warm_vision(&self) -> Result<(), String>
Load the tower now (a server does it at startup).
Sourcepub fn audio(&self) -> Result<&AudioTower, String>
pub fn audio(&self) -> Result<&AudioTower, String>
The audio tower, loaded on first use (~1.2 GB of f32 weights).
Sourcepub fn warm_audio(&self) -> Result<(), String>
pub fn warm_audio(&self) -> Result<(), String>
Load the audio tower now.
Sourcepub fn warm_for(&self, inputs: &[MixedInput]) -> Result<(), String>
pub fn warm_for(&self, inputs: &[MixedInput]) -> Result<(), String>
Load the towers the inputs need (their one-time load stays out of a timed forward).
Sourcepub fn prepare_image(
&self,
img: &RgbFrame,
budget: Option<usize>,
) -> Result<Media, String>
pub fn prepare_image( &self, img: &RgbFrame, budget: Option<usize>, ) -> Result<Media, String>
An image at budget soft tokens (None: the processor’s default).
Sourcepub fn prepare_frames(
&self,
frames: &[RgbFrame],
budget: Option<usize>,
) -> Result<Media, String>
pub fn prepare_frames( &self, frames: &[RgbFrame], budget: Option<usize>, ) -> Result<Media, String>
Sampled video frames at budget soft tokens a frame.
Sourcepub fn input_ids(&self, input: &MixedInput) -> Result<Vec<u32>, String>
pub fn input_ids(&self, input: &MixedInput) -> Result<Vec<u32>, String>
Token ids of one input, every placeholder expanded.
Auto Trait Implementations§
impl !Freeze for MediaEncoder
impl !RefUnwindSafe for MediaEncoder
impl !UnwindSafe for MediaEncoder
impl Send for MediaEncoder
impl Sync for MediaEncoder
impl Unpin for MediaEncoder
impl UnsafeUnpin for MediaEncoder
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