Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions crates/multimodal/scripts/check_worker_anchor_parity.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@
"video": ("config_id", "video_token_index"),
},
},
"kimi_k3": {
"model_id": "moonshotai/Kimi-K3",
# Anchor = tokenizer token for the config's media_placeholder_token_id.
"anchors": {"image": ("config_id", "media_placeholder_token_id")},
},
"glm53_flash": {
"model_id": "zai-org/GLM-5.3-Flash",
# Anchor = tokenizer token for the config's image_token_id. Video is
# deliberately absent: vLLM targets a three-token block for it.
"anchors": {"image": ("config_id", "image_token_id")},
},
}

PREFIX_TEXT = "Describe what you see."
Expand Down
14 changes: 14 additions & 0 deletions crates/multimodal/src/registry/glm53_flash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ impl ModelProcessorSpec for Glm53FlashSpec {
}
}

/// `<|image|>` is vLLM's single-token image target; video is not, its
/// target is the three-token `<|begin_of_video|>…<|end_of_video|>` block.
fn worker_expandable(&self, modality: Modality) -> bool {
matches!(modality, Modality::Image)
}

fn modality_limits(
&self,
metadata: &ModelMetadata,
Expand Down Expand Up @@ -403,4 +409,12 @@ mod tests {
Err(ModelRegistryError::InvalidPreprocessedField { .. })
));
}

#[test]
fn only_the_image_anchor_can_be_expanded_by_the_worker() {
let spec = Glm53FlashSpec;
assert!(spec.worker_expandable(Modality::Image));
assert!(!spec.worker_expandable(Modality::Video));
assert!(!spec.worker_expandable(Modality::Audio));
}
}
16 changes: 16 additions & 0 deletions crates/multimodal/src/registry/kimi_k3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ impl ModelProcessorSpec for KimiK3VisionSpec {
Self::pad_token_id(metadata)
}

/// `<|media_pad|>` is the single token vLLM's `kimi_k3` prompt updates
/// replace with the dimensioned media block.
fn worker_expandable(&self, modality: Modality) -> bool {
matches!(modality, Modality::Image)
}

fn modality_limits(
&self,
_metadata: &ModelMetadata,
Expand Down Expand Up @@ -279,6 +285,16 @@ mod tests {
);
}

#[test]
fn image_anchor_can_be_expanded_by_the_worker() {
use crate::registry::ModelProcessorSpec;

let spec = super::KimiK3VisionSpec;
assert!(spec.worker_expandable(Modality::Image));
assert!(!spec.worker_expandable(Modality::Video));
assert!(!spec.worker_expandable(Modality::Audio));
}

#[test]
fn kimi_k3_dimensions_are_per_image() {
let tokenizer = k3_tokenizer();
Expand Down
Loading