vllm.model_executor.models.isaac ¶
Classes:
-
IsaacForConditionalGeneration– -
IsaacImagePixelInputs–Schema for validating Isaac image inputs.
-
Siglip2VisionTransformer–
Functions:
-
create_cumulative_seq_lengths–Create cumulative sequence lengths for variable-length attention.
-
create_pixel_shuffle_index_map–Build a gather-index map that tells us, for every output token after
-
pixel_shuffle_varlen–Apply pixel shuffle to a packed vision sequence without unpacking per image.
IsaacForConditionalGeneration ¶
Bases: Module, SupportsMultiModal, SupportsLoRA, SupportsPP, SupportsMRoPE
Methods:
-
get_mm_mapping–Get the module prefix in multimodal models
Source code in vllm/model_executor/models/isaac.py
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 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 | |
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
Methods:
-
forward–spatial_shapes (
torch.LongTensorof shape(batch_size, 2)):
Source code in vllm/model_executor/models/isaac.py
forward(packed_seq_patches) ¶
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(seq_sizes, device) ¶
Create cumulative sequence lengths for variable-length attention.
Source code in vllm/model_executor/models/isaac.py
create_pixel_shuffle_index_map(seq_sizes, token_grids, scale_factor=1, device=None) ¶
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(x, token_grids, scale_factor=1) ¶
Apply pixel shuffle to a packed vision sequence without unpacking per image.
Parameters:
-
(x¶`torch.Tensor`) –Concatenated vision embeddings. Accepts
(seq_len, hidden_size)or(1, seq_len, hidden_size)shapes produced by stacking image patches. -
(token_grids¶`torch.Tensor`) –Integer tensor of shape
(num_images, 2)whose rows give the(height, width)patch grid sizes corresponding to each image segment insidex. -
(scale_factor¶`int`, *optional*, defaults to 1, default:1) –Spatial down-sampling factor specific to pixel shuffle. Values greater than one merge
scale_factor**2neighboring patches into a single embedding channel-group.
Returns:
-
Tensor–torch.Tensor: Pixel-shuffled embeddings with shape matching the input -
convention(Tensor) –(seq_len, hidden_size * scale_factor**2)when the input -
Tensor–was 2D, or
(1, seq_len, hidden_size * scale_factor**2)if the -
Tensor–singleton batch dimension was present.
Raises:
-
ValueError–If more than one batch item is provided.