Skip to main content

SmolVlm

Struct SmolVlm 

Source
pub struct SmolVlm { /* private fields */ }
Expand description

SmolVLM-256M-Instruct on candle: SigLIP tower, pixel-shuffle connector, Llama decoder.

Chosen in Gate 1.2 over SmolVLM2 for one decidable reason: only v1 has a published OCRBench row to be scored against, which is what makes Arm 1 an external number rather than our own claim.

Implementations§

Source§

impl SmolVlm

Source

pub fn new() -> Self

An engine reading manifests from the workspace’s models/ directory.

Source

pub const fn with_manifest_dir(dir: PathBuf) -> Self

Source

pub fn from_bytes(w: ArgusBytes) -> Result<Self>

Build from weights the caller already holds — no std::fs, no mmap and no manifest on this path at all.

new() and with_manifest_dir defer loading to first use, where they reach a manifest, the model cache and an mmap. A browser has none of the three, so this is the constructor a wasm build uses.

Eager, not lazy: the caller has already paid to get the bytes here, so there is nothing left to defer, and a malformed checkpoint surfaces at construction rather than on the first image.

Source

pub fn is_loaded(&self) -> bool

Are the weights already resident?

Loading is ~1 GB of safetensors and happens once, on first use. A caller timing a caption needs to know whether that cost landed inside the measurement, because a first call that includes it is not the same event as a warm one and averaging the two describes neither.

Source

pub fn warm(&self) -> Result<()>

Force the load now, so a later timed call does not pay for it.

§Errors

Whatever loading the checkpoint would return.

Source§

impl SmolVlm

Source

pub fn describe_image_unsplit( &self, image: &ImageBuffer, opts: &VlmOptions, ) -> Result<String>

VlmEngine::describe_image, with a stage-by-stage timing trace.

Same code path as the untraced call — it is the untraced call, with a trace threaded through — so the numbers describe what actually runs rather than a parallel implementation that exists to be measured.

§Errors

Whatever describe_image would return. Caption a still with tile splitting off — one tile, not seventeen.

VlmEngine::describe_image splits, because seventeen tiles is what lets the model read fine print and a single still has all 8192 text positions to itself. That is the right default when the compute is free. It is not free everywhere.

A split still is 17 tiles / 1088 image tokens; unsplit it is 1 tile / 64 tokens, so the vision tower does roughly a seventeenth of the work. describe_video has always taken this path — not to trade quality for speed, but because a split frame caps a window at seven frames against the tower’s 8192 positions. Wasm wants it for the other reason: the browser has no threads, and 17 tiles of scalar-plus-gemm arithmetic is minutes per image.

The detail loss is bounded and known. The unsplit tile is exactly the global thumbnail the split path already computes and prepends, so this is not a different preprocessing path with its own oracle — it is the same path, stopping before the tiles. What goes is fine print and small objects; what stays is the whole-image gist the thumbnail carries.

Prefer VlmEngine::describe_image wherever the seventeen tiles are affordable.

Source

pub fn describe_image_traced( &self, image: &ImageBuffer, opts: &VlmOptions, ) -> Result<(String, CaptionTrace)>

Trait Implementations§

Source§

impl Default for SmolVlm

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl VlmEngine for SmolVlm

Source§

fn info(&self) -> EngineInfo

Source§

fn describe(&self, prompt: &VlmPrompt<'_>, opts: &VlmOptions) -> Result<String>

The general path: an ordered, interleaved multimodal prompt. Read more
Source§

fn describe_video( &self, frames: &[VideoFrame], opts: &VlmOptions, ) -> Result<Vec<TimedSegment<String>>>

Video understanding over sampled frames → a timed caption track. Read more
Source§

fn describe_image( &self, image: &ImageBuffer, opts: &VlmOptions, ) -> Result<String, Error>

One image, with VlmOptions::prompt as the instruction. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more