nemo_automodel.components.speculative.eagle.vispec_target
nemo_automodel.components.speculative.eagle.vispec_target
Target-model wrapper for ViSpec draft training on a vision-language target.
Where the EAGLE-1/2 wrapper hands the draft token ids, ViSpec hands it the target’s embedding-layer output: at image positions there is no token embedding to look up, only the vision tower’s projected features, and those features are exactly what the draft’s image adaptor compresses. The wrapper therefore returns the target’s layer-0 hidden states alongside the usual last-hidden-state / logits supervision, plus the image-token mask that tells the draft which positions to compress.
Module Contents
Classes
API
Expose embedding-layer, last-hidden-state, and logit supervision from a VLM target.
Parameters:
The frozen vision-language target model.
Token id the target uses as an image placeholder; every position holding it carries a vision feature instead of a token embedding.
Run the frozen target once and assemble the draft’s supervision.
Parameters:
Tensor of shape [batch, sequence].
Tensor of shape [batch, sequence]; 1 for real tokens.
Tensor of shape [batch, sequence]; 1 at supervised positions.
The processor’s vision tensors for this batch
(e.g. pixel_values of shape [patches, patch_dim] and
image_grid_thw of shape [images, 3] for Qwen2.5-VL). Keys the
target’s forward does not declare are dropped.
Returns: VispecTargetBatch
VispecTargetBatch, with every tensor on the target’s device.
Return the target model input embeddings.
Return the target model lm_head.
Target-model outputs needed by :class:VispecTrainerModule.