vllm.model_executor.models.isaac ¶
IsaacForConditionalGeneration ¶
Bases: Module, SupportsMultiModal, SupportsLoRA, SupportsPP, SupportsMRoPE
Source code in vllm/model_executor/models/isaac.py
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 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 | |
get_mm_mapping ¶
Get the module prefix in multimodal models
Source code in vllm/model_executor/models/isaac.py
IsaacImagePixelInputs ¶
Bases: TensorSchema
Schema for validating Isaac image inputs.
Dimensions
- np: Number of patches
- d: Patch dimension
- ni: Number of images
The schema enforces
- pixel_values must be 2D: (num_patches, patch_dim)
- image_grid_thw must be 2D: (num_images, 3) where 3 represents [T, H, W]
Source code in vllm/model_executor/models/isaac.py
Siglip2VisionTransformer ¶
Bases: Module
Source code in vllm/model_executor/models/isaac.py
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 | |
forward ¶
spatial_shapes (torch.LongTensor of shape (batch_size, 2)): Tensor containing the spatial dimensions (height, width) of the input images.
Source code in vllm/model_executor/models/isaac.py
create_cumulative_seq_lengths ¶
Create cumulative sequence lengths for variable-length attention.
Source code in vllm/model_executor/models/isaac.py
create_pixel_shuffle_index_map ¶
create_pixel_shuffle_index_map(
seq_sizes: Tensor,
token_grids: Tensor,
scale_factor: int = 1,
device: device | None = None,
) -> Tensor
Build a gather-index map that tells us, for every output token after pixel-shuffle, which scale_factor**2 input tokens are being merged.
Args¶
seq_sizes : (num_images,) - #patches in each image (row-major order) token_grids : (num_images,2) - (height, width) for every image scale_factor : spatial down-scale factor (≥2) device : (optional) overrides seq_sizes.device
Returns¶
gather_idx : (new_total_seq_len, scale_factor2) int64 tensor. gather_idx[i, j] is the flat index into the original packed sequence for the j-th sub-patch that forms the i-th output token.
Source code in vllm/model_executor/models/isaac.py
pixel_shuffle_varlen ¶
Apply pixel shuffle to a packed vision sequence without unpacking per image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x | `torch.Tensor` | Concatenated vision embeddings. Accepts | required |
token_grids | `torch.Tensor` | Integer tensor of shape | required |
scale_factor | `int`, *optional*, defaults to 1 | Spatial down-sampling factor specific to pixel shuffle. Values greater than one merge | 1 |
Returns:
| Name | Type | Description |
|---|---|---|
Tensor |
| |
convention | Tensor |
|
Tensor | was 2D, or | |
Tensor | singleton batch dimension was present. |
Raises:
| Type | Description |
|---|---|
ValueError | If more than one batch item is provided. |