pub fn replace_janus_placeholders(
input_ids: &[i64],
config: &JanusPlaceholderConfig,
device: Device,
) -> Result<JanusPlaceholderReplacement>Expand description
Replace Janus image placeholder tokens with proper token sequence
This follows the official Janus design:
- Find all
<image_placeholder>tokens in input_ids - Replace each with: <begin_of_image> + 576 x <image_token> + <end_of_image>
- Create masks for embedding replacement
§Arguments
input_ids- Original token IDs [seq_len]config- Placeholder configuration with token IDsdevice- Target device for tensors
§Returns
JanusPlaceholderReplacement with expanded tokens and masks