mstar.model.qwen3_5.video#
Qwen3.5 video input: frame sampling, timestamps and the prompt layout.
Mirrors transformers’ Qwen3VLProcessor / Qwen3VLVideoProcessor, which
Qwen3.5 checkpoints name. A video renders as its chat-template triple with the
pad replaced, per temporal group of temporal_patch_size frames, by
<{t:.1f} seconds><|vision_start|><|video_pad|>*n<|vision_end|>; the outer
sentinels stay. Only the pads are vision tokens: timestamps and every sentinel
take text positions, and each group is placed in MRoPE like a one-frame image.
Kept free of engine imports so the parts that must match transformers can be tested without Triton.
Functions
|
Replace the nth |
|
Seconds per temporal group: the mean of its first and last frame's time. |
|
Decode the frames the checkpoint's video processor would sample. |
Classes
|
One video as the vision walk takes it. |
|
What |
- class mstar.model.qwen3_5.video.ProcessedVideo(pixel_values, grid, timestamps)[source]#
Bases:
NamedTupleOne video as the vision walk takes it.
- class mstar.model.qwen3_5.video.SampledVideo(frames, metadata)[source]#
Bases:
NamedTupleWhat
load_videohandsprocess_prompt: the sampled frames only.
- mstar.model.qwen3_5.video.expand_video_pads(text, pad, start, end, timestamps)[source]#
Replace the nth
padintextwith the nth video’s groups.One pad per group, expanded to the group’s tokens afterwards (expand_media_pads), as an image’s pad is.
- mstar.model.qwen3_5.video.group_timestamps(frames_indices, fps, temporal_patch_size)[source]#
Seconds per temporal group: the mean of its first and last frame’s time.
Qwen3VLProcessor._calculate_timestamps, including its padding of an uneven tail with the last index (the patchifier repeats the last frame the same way) and its 24 fps fallback.
- mstar.model.qwen3_5.video.sample_video(path, video_processor)[source]#
Decode the frames the checkpoint’s video processor would sample.
The same call transformers makes for a video path: torchcodec on the host (
seek_mode="exact"), indices from the processor’s ownsample_frames(fpsper second, clamped to[min_frames, max_frames]), and only those frames decoded. Not on the GPU: NVDEC’s colour conversion need not match FFmpeg’s, and there is no fallback decoder for the same reason.- Parameters:
path (str)
- Return type: