vllm.model_executor.models.radio
¶
RADIO vision encoder, matching the RadioModel in the Transformers library.
The module tree mirrors the Transformers RadioModel (embeddings and an
encoder.layer stack of norm1/attention/layer_scale1/norm2/
mlp/layer_scale2 blocks). The vLLM-specific deviations are the fused
attention.qkv (a QKVParallelLinear
for TP/quantization, vs the split query/key/value in HF) and running
input normalization in the processor instead of an input_conditioner module;
the attention backend and MLP reuse vLLM's MMEncoderAttention and
InternMLP. load_weights maps
both native Transformers and legacy remote-code checkpoint keys onto this tree
via hf_to_vllm_mapper.
Classes:
-
RadioAttention–RADIO self-attention: a fused
qkvprojection feeding the vLLM -
RadioLayer–RADIO transformer block, mirroring the Transformers
RadioLayer -
RadioLayerScale–LayerScale matching the Transformers
RadioLayerScale: alambda1 -
RadioModel– -
RadioPatchEmbeddings–Cropped Position Embedding (CPE) patch generator, matching Transformers'
-
RadioVisionEncoder–RADIO encoder stack, mirroring the Transformers
RadioEncodermodule
Functions:
-
radio_config_from_args–Build a
RadioConfigfrom the timm-styleargsof remote-code checkpoints.
RadioAttention
¶
Bases: Module
RADIO self-attention: a fused qkv projection feeding the vLLM
attention backend, with optional QK-normalization and dynamic-resolution
packed attention (via mask_meta). The fused counterpart of the
Transformers RadioAttention (which keeps query/key/value and
output.dense split); load_weights bridges the two.
Source code in vllm/model_executor/models/radio.py
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 | |
RadioLayer
¶
Bases: Module
RADIO transformer block, mirroring the Transformers RadioLayer
(norm1 / attention / layer_scale1 / norm2 / mlp /
layer_scale2). drop_path is an inference-time Identity; the MLP
reuses InternMLP (fc1/fc2, matching RadioMLP).
Source code in vllm/model_executor/models/radio.py
RadioLayerScale
¶
Bases: Module
LayerScale matching the Transformers RadioLayerScale: a lambda1
parameter scaling the residual branch.
Source code in vllm/model_executor/models/radio.py
RadioModel
¶
Bases: Module
Methods:
-
load_weights–Load RADIO checkpoint weights, remapping legacy remote-code and
Source code in vllm/model_executor/models/radio.py
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 | |
_inter_image_mask_metadata(imgs_sizes, device)
¶
Build mask metadata from image pixel sizes. Adds num_skip to each
sequence length (cls/register tokens) to match patch generator output.
Source code in vllm/model_executor/models/radio.py
_mask_metadata_from_seq_lens(seq_lens, device)
¶
Build mask metadata from sequence lengths (already including
cls/register tokens, i.e. patch_count + num_skip per item).
Source code in vllm/model_executor/models/radio.py
_pack_uniform_batch(hidden_states)
¶
Pack [B, n, hidden] into [1, B*n, hidden] plus its varlen metadata.
FA/Triton synthesise this cu_seqlens anyway; TORCH_SDPA splits it per item.
Source code in vllm/model_executor/models/radio.py
load_weights(weights)
¶
Load RADIO checkpoint weights, remapping legacy remote-code and
native Transformers keys onto this module tree via
hf_to_vllm_mapper.
Source code in vllm/model_executor/models/radio.py
RadioPatchEmbeddings
¶
Bases: Module
Cropped Position Embedding (CPE) patch generator, matching Transformers'
RadioPatchEmbeddings, with additional support for dynamic multi-resolution
packing and video temporal compression.
Methods:
-
forward_video–Process video frames with temporal compression.
Source code in vllm/model_executor/models/radio.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | |
forward_video(x)
¶
Process video frames with temporal compression.
Groups T consecutive frames into tubelets before embedding.
Parameters:
Returns:
-
Tensor–Embedded patches with temporal compression applied.
Source code in vllm/model_executor/models/radio.py
RadioVisionEncoder
¶
Bases: Module
RADIO encoder stack, mirroring the Transformers RadioEncoder module
tree (a layer ModuleList of RadioLayer).
Source code in vllm/model_executor/models/radio.py
radio_config_from_args(args, *, image_size=224, patch_size=16, norm_mean=None, norm_std=None, video_temporal_patch_size=1)
¶
Build a RadioConfig from the timm-style args of remote-code checkpoints.