vllm.models.glm5next.common.model
¶
Classes:
_LOGIT_SCALE = 1.0
module-attribute
¶
Output logit scale. A GLM-5.3-Flash trained value that neither the
checkpoint nor Glm5NextTextConfig carries.
_MHC_POST_MULT_VALUE = 2.0
module-attribute
¶
mHC post-multiplier. A GLM-5.3-Flash trained value that neither the
checkpoint nor Glm5NextTextConfig carries.
_MHC_TAU = 0.05
module-attribute
¶
mHC routing temperature. A GLM-5.3-Flash trained value that neither the
checkpoint nor Glm5NextTextConfig carries.
_VISION_RMS_NORM_EPS = 1e-06
module-attribute
¶
Vision tower RMSNorm epsilon.
GLM-5.3-Flash checkpoints ship vision_config.rms_norm_eps = 1e-5, but the
vision tower was trained with 1e-6. Serving with 1e-5 drifts the RMSNorm and
produces repetitive/degraded image descriptions, so force the trained value
regardless of the checkpoint field.
Glm5NextModel
¶
Bases: Module, EagleModelMixin
Source code in vllm/models/glm5next/common/model.py
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 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 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 | |
_aux_hidden_state(hidden_states, residual, post, comb)
¶
Completed residual stream entering a layer, as one hidden vector.
mHC layers defer their final hc_post into the next layer's fused
pre-op, so hidden_states holds the raw layer output while the
widened stream is completed here and contracted back to
hidden_size. Non-mHC layers already return the summed stream.
Source code in vllm/models/glm5next/common/model.py
_dequant_fp8_block(weight_fp8, scale_inv, block_size=128)
¶
Dequantize a block-FP8 (e4m3) weight with per-block scale to BF16.
Unlike scaled_dequantize this tolerates a non-divisible (partial last
block) shape by zero-padding to a multiple of block_size before the
scale broadcast and trimming back afterwards (e.g. kv_a_proj_with_mqa is
576 rows = 4*128 + 64).
Source code in vllm/models/glm5next/common/model.py
_fused_shared_expert_name(name, n_routed_experts)
¶
Point a checkpoint mlp.shared_experts.* tensor at the fused MoE's
shared-expert slot, which follows the routed experts; other names are
returned unchanged.
Source code in vllm/models/glm5next/common/model.py
_fused_shared_experts_tuned(parallel_config)
¶
AITER has fused-MoE configs tuned for the fused shared-expert shape (one more expert and one more top-k slot than the routed MoE) only on gfx950, with every expert on each rank and its weights split by TP4 or TP8. Data, prefill context and expert parallelism change that split, so any other GPU or parallel layout would run untuned fallback kernels.
Source code in vllm/models/glm5next/common/model.py
_num_fused_shared_experts(n_shared_experts, enabled)
¶
Expert slots the fused MoE appends for the shared expert; must match the
num_fused_shared_experts that FusedMoE allocates.
Source code in vllm/models/glm5next/common/model.py
_try_load_fp8_attn_proj(name, tensor, buf, params_dict, loaded_params, kv_a_pad_size)
¶
Dequantize FP8 q_a_proj / kv_a_proj_with_mqa / o_proj to BF16 on load.
The FP8 checkpoint stores these as block-FP8 (weight + weight_scale_inv),
but the model holds them in BF16 (fused_qkv_a_proj is always BF16 via
DeepSeekV2FusedQkvAProjLinear; o_proj is excluded by
modules_to_not_convert). When the model target is BF16 (no
weight_scale_inv param) we dequantize; otherwise we return False so the
normal stacked/direct path loads the FP8 tensor as-is.
Source code in vllm/models/glm5next/common/model.py
1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 | |
_validate_supported_config(config)
¶
Reject checkpoints using config options this implementation lacks.
The kpool indexer kernels always keep the incomplete trailing pool, so a checkpoint asking otherwise would be served silently wrong.