vllm.model_executor.models.bert ¶
Classes:
-
BertEmbeddingModel–A model that uses Bert to provide embedding functionalities.
-
BertForMaskedLM–Bert with a masked-language-modeling head on top of
BertModel. -
BertForSequenceClassification–A model that uses Bert to provide embedding functionalities.
-
BertSpladeSparseEmbeddingModel–BertEmbeddingModel + SPLADE sparse embedding.
-
SPLADESparsePooler–SPLADE sparse pooling:
BertEmbeddingModel ¶
Bases: Module, SupportsQuant
A model that uses Bert to provide embedding functionalities.
This class encapsulates the BertModel and provides an interface for embedding operations and customized pooling functions.
Attributes:
-
model–An instance of BertModel used for forward operations.
-
_pooler–An instance of Pooler used for pooling operations.
Source code in vllm/model_executor/models/bert.py
BertForMaskedLM ¶
Bases: Module
Bert with a masked-language-modeling head on top of BertModel.
Produces per-token logits over the vocabulary. In vLLM terms this is a token-level pooling model (tok_pooling_type="ALL"): the encoder output is projected by the MLM head to vocab_size logits for every position, and the token pooler returns one vector per token.
Source code in vllm/model_executor/models/bert.py
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 | |
BertForSequenceClassification ¶
Bases: Module, SupportsCrossEncoding, SupportsQuant
A model that uses Bert to provide embedding functionalities.
This class encapsulates the BertModel and provides an interface for embedding operations and customized pooling functions.
Attributes:
-
model–An instance of BertModel used for forward operations.
-
_pooler–An instance of Pooler used for pooling operations.
Source code in vllm/model_executor/models/bert.py
BertSpladeSparseEmbeddingModel ¶
Bases: BertEmbeddingModel
BertEmbeddingModel + SPLADE sparse embedding. - Make logits by self.mlm_head - pooler: SPLADESparsePooler(mlm_head...)
Source code in vllm/model_executor/models/bert.py
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 | |
SPLADESparsePooler ¶
Bases: Pooler
SPLADE sparse pooling: logits = mlm_head(hidden_states) -> log1p(relu(logits)) -> (max|sum over L) -> [V]
Padding is masked with an attention mask, [CLS]/[SEP] is removed (selected), and then pooled.
Source code in vllm/model_executor/models/bert.py
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 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 | |