vllm.model_executor.models.minicpmv4_7
¶
Inference-only MiniCPM-V 4.7 model.
Same vision/LLM stack as MiniCPM-V 4.6, plus canvas 3D M-RoPE.
Functions:
-
canvas_rope_delta–Offset applied to the 1-D positions of tokens decoded after the prompt.
_CanvasLayout
¶
Bases: NamedTuple
Grid of one canvas measured in LLM tokens.
A canvas is a thumbnail plus the slices cut from it, tiled row-major.
Attributes:
-
cols(int) –Slices sharing a canvas row. Zero when the canvas has no slices.
-
slice_w(int) –Per-slice grid. Zero when the canvas has no slices.
-
thumb_w(int) –Thumbnail grid.
-
width(int) –Assembled canvas.
Source code in vllm/model_executor/models/minicpmv4_7.py
_assign_canvas_span(pos3d, *, thumbnail, span_end, slices, base, target_sizes)
¶
Place one canvas at base, writing its 3-D positions into pos3d.
Shared by the video-frame and single-image paths; they differ only in how the per-canvas base advances, not in the geometry placed here.
Mutates pos3d in place, as the packed canvas computation has always
done. Returns the distance to the next canvas base, so each caller keeps
only its own base advancement.
Source code in vllm/model_executor/models/minicpmv4_7.py
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 | |
_canvas_layout(thumbnail, slices, target_sizes)
¶
Measure the canvas for one (thumbnail, slices) group.
thumbnail and each slice are (start, end, target_index) token spans.
Source code in vllm/model_executor/models/minicpmv4_7.py
_sequential_positions(seq_len)
¶
Positions for the fallback where canvas M-RoPE cannot be computed.
_target_hw(target_sizes, index)
¶
Patch-grid height/width recorded for one image or slice.
canvas_rope_delta(position_ids, seq_len)
¶
Offset applied to the 1-D positions of tokens decoded after the prompt.
The first decoded token sits one past the last prefill position.