vllm.model_executor.models.whisper ¶
WhisperAudioInputs ¶
Bases: TensorSchema
Dimensions
- b: Batch size
- nmb: Number of mel bins
- t: Time frames (M)
Source code in vllm/model_executor/models/whisper.py
WhisperEncoderAttention ¶
Bases: MMEncoderAttention
Multi-headed attention for Whisper encoder with 2D tensor support.
Source code in vllm/model_executor/models/whisper.py
forward ¶
batch_size x seq_len x hidden_size
or seq_len x hidden_size
Source code in vllm/model_executor/models/whisper.py
WhisperForConditionalGeneration ¶
Bases: Module, SupportsTranscription, SupportsMultiModal
Source code in vllm/model_executor/models/whisper.py
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 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 | |
get_language_detection_prompt classmethod ¶
get_language_detection_prompt(
audio: ndarray, stt_config: SpeechToTextConfig
) -> PromptType
Return a prompt that elicits a single language token from Whisper.
Feed only <|startoftranscript|> as the decoder input so the model predicts the most likely language token (e.g. <|de|>).
Source code in vllm/model_executor/models/whisper.py
get_language_token_ids classmethod ¶
Return token IDs for all supported language tokens.
Used with SamplingParams.allowed_token_ids to constrain language detection to only produce valid language tokens.
Source code in vllm/model_executor/models/whisper.py
parse_language_detection_output classmethod ¶
Parse the language token predicted by Whisper.
Decodes the first token ID and extracts the language code from the <|xx|> format. Expects a valid language token from constrained generation.
Source code in vllm/model_executor/models/whisper.py
WhisperProcessingInfo ¶
Bases: BaseProcessingInfo
Source code in vllm/model_executor/models/whisper.py
_create_fake_bias_for_k_proj ¶
_create_fake_bias_for_k_proj(
weights: Iterable[tuple[str, Tensor]],
fake_bias_key_name: str,
) -> Iterable[tuple[str, Tensor]]
Create full zeros bias for k_proj weight in self-attn and x-attn layers. So that the bias for k_proj in qkv_proj can be initialized with zeros.