pub struct MimoMm {
pub source: MimoMmSource,
pub config: Value,
pub audio_tokenizer_config: Value,
pub vision: MimoVisionGeom,
pub audio: MimoAudioGeom,
pub audio_tokenizer: MimoAudioTokenizerGeom,
pub tokens: MimoTokenIds,
pub hidden_size: usize,
pub provenance: Option<Value>,
/* private fields */
}Expand description
Data holder for the MiMo-V2 towers: the container handle, the parsed
configs and geometry, and typed tensor access. Building one validates
the whole tower inventory (names, shapes, codebook dtype) and the pinned
special ids; Self::validate_text checks the pairing with a text model.
Fields§
§source: MimoMmSource§config: ValueThe full source config.json.
audio_tokenizer_config: Valueaudio_tokenizer/config.json.
vision: MimoVisionGeom§audio: MimoAudioGeom§audio_tokenizer: MimoAudioTokenizerGeom§tokens: MimoTokenIdsLLM hidden size the towers project into (4096).
provenance: Option<Value>provenance.mimo_mm as written by the converter (codec per group,
config sha256, source revision), when present.
Implementations§
Source§impl MimoMm
impl MimoMm
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self, String>
pub fn open(path: impl AsRef<Path>) -> Result<Self, String>
Open a companion (or single-file multimodal CMF) by path.
Sourcepub fn from_model(model: &Arc<CmfModel>) -> Result<Self, String>
pub fn from_model(model: &Arc<CmfModel>) -> Result<Self, String>
Build from an open container: a mimo_v2_mm companion, or a
mimo_v2 file that carries the towers. Every inconsistency is an
error; nothing is defaulted.
Sourcepub fn discover(
text_path: &Path,
explicit: Option<&Path>,
) -> Result<Option<PathBuf>, String>
pub fn discover( text_path: &Path, explicit: Option<&Path>, ) -> Result<Option<PathBuf>, String>
Find the companion of a text CMF: explicit (must exist), else
<stem>.mm.cmf beside it (the stem without .cmf and without a
-NNNNN-of-NNNNN shard suffix), else the only *.mm.cmf in the
directory. Ok(None) when there is none; two candidates are an error.
Sourcepub fn attach(
text: &Arc<CmfModel>,
explicit: Option<&Path>,
) -> Result<Option<Self>, String>
pub fn attach( text: &Arc<CmfModel>, explicit: Option<&Path>, ) -> Result<Option<Self>, String>
Towers for a text model: the file’s own towers (single-file
multimodal), else a discovered or explicit companion — validated
against the text model (Self::validate_text_model). Ok(None):
the model is not mimo_v2, or no towers exist anywhere. An explicit
--mm on a non-MiMo model is an error.
Sourcepub fn validate_text_model(&self, text: &CmfModel) -> Result<(), String>
pub fn validate_text_model(&self, text: &CmfModel) -> Result<(), String>
Self::validate_text with the tokenizer embedded in the text CMF
(a text file without one cannot be checked and is refused).
Sourcepub fn validate_text(
&self,
text: &CmfModel,
tok: &Tokenizer,
) -> Result<(), String>
pub fn validate_text( &self, text: &CmfModel, tok: &Tokenizer, ) -> Result<(), String>
Hard checks that this tower set belongs to text: arch mimo_v2,
the same hidden size, and a tokenizer that maps the nine special
tokens to the pinned ids.
pub fn has(&self, name: &str) -> bool
Sourcepub fn entry(&self, name: &str) -> Result<&TensorEntry, String>
pub fn entry(&self, name: &str) -> Result<&TensorEntry, String>
Directory entry (dtype, shape) of a tensor.
Sourcepub fn dtype(&self, name: &str) -> Option<TensorDtype>
pub fn dtype(&self, name: &str) -> Option<TensorDtype>
Storage dtype of a tensor, if present.
Sourcepub fn linear(
&self,
name: &str,
rows: usize,
cols: usize,
) -> Result<QTensor, String>
pub fn linear( &self, name: &str, rows: usize, cols: usize, ) -> Result<QTensor, String>
A 2-D weight [rows, cols] on the engine’s kernels (quantized
payloads stay memory-mapped; F16/F32 dequantize to f32 once).
Sourcepub fn f32(&self, name: &str) -> Result<Vec<f32>, String>
pub fn f32(&self, name: &str) -> Result<Vec<f32>, String>
Any tensor dequantized to f32 (row-major, directory shape).
Sourcepub fn f32_shaped(
&self,
name: &str,
shape: &[usize],
) -> Result<Vec<f32>, String>
pub fn f32_shaped( &self, name: &str, shape: &[usize], ) -> Result<Vec<f32>, String>
Self::f32 with a shape check.
Sourcepub fn group_codec(&self, group: MimoTowerGroup) -> Option<&str>
pub fn group_codec(&self, group: MimoTowerGroup) -> Option<&str>
Codec recorded by the converter for a tower group (“q4tp”, “f16”, …).