pub struct Qwen3Encoder {
pub hidden: usize,
/* private fields */
}Fields§
Implementations§
Source§impl Qwen3Encoder
impl Qwen3Encoder
pub fn from_cmf(model: &Arc<CmfModel>) -> Result<Self, String>
Sourcepub fn set_exact_q8(&mut self, on: bool)
pub fn set_exact_q8(&mut self, on: bool)
Weight-only exact q8 projections (f32 activations; see
q8_exact_matmat). Off by default, so every existing caller keeps
its numbers; Z-Image turns it on.
Sourcepub fn set_device_ops(&mut self, spec: &str)
pub fn set_device_ops(&mut self, spec: &str)
Route the named projections (all, or a comma list of
PROJ_NAMES) through the device GEMM of their codec; the host
kernels stay the fallback. Experiment knob (CMF_ZIMAGE_TE_DEV in the Z-Image pipeline, ZC_TE_DEV in examples/zimage_techeck.rs).
Sourcepub fn encode(&self, ids: &[u32]) -> Vec<f32>
pub fn encode(&self, ids: &[u32]) -> Vec<f32>
Causal full-sequence forward. Returns [n, hidden] — the
residual stream leaving the last layer, normed only if the
config says the checkpoint has a final norm (H3’s does not).
Sourcepub fn encode_with_images(
&self,
ids: &[u32],
spans: &[ImageSpan],
embeds: &[Vec<f32>],
deepstack: &[Vec<f32>],
) -> Vec<f32>
pub fn encode_with_images( &self, ids: &[u32], spans: &[ImageSpan], embeds: &[Vec<f32>], deepstack: &[Vec<f32>], ) -> Vec<f32>
Full forward with images. embeds replaces the token embedding
at [span.start, span.start + span.len) with the vision tower’s
merged tokens; deepstack[k] is added at the visual positions
after LM layer k — the first layers, not the vision layers the
features were taken from.
Width of what encode returns — the DiT’s conditioning width,
which is the projection’s output when one is packed and the
encoder’s own hidden size otherwise.