@@ -117,6 +117,8 @@ type (
117117 RoPEScalingOriginalContextLength uint64 `json:"ropeScalingOriginalContextLength,omitempty"`
118118 // RoPEScalingFinetuned is true if the RoPE scaling is fine-tuned.
119119 RoPEScalingFinetuned bool `json:"ropeScalingFinetuned,omitempty"`
120+ // PoolingType is the type of pooling used in the model.
121+ PoolingType uint32 `json:"poolingType,omitempty"`
120122 // SSMConvolutionKernel is the size of the convolution kernel used in the Selective State Space Model (SSM) and similar architectures.
121123 SSMConvolutionKernel uint32 `json:"ssmConvolutionKernel,omitempty"`
122124 // SSMInnerSize is the embedding size of the state in SSM and similar architectures.
@@ -857,6 +859,8 @@ func (gf *GGUFFile) transformerArchitecture(arch string) (ga GGUFArchitecture) {
857859 ropeScalingOriginalContextKey = arch + ".rope.scaling.original_context_length" // uint32 maybe
858860 ropeScalingFinetunedKey = arch + ".rope.scaling.finetuned"
859861
862+ poolingTypeKey = arch + ".pooling_type"
863+
860864 ssmConvolutionKernelKey = arch + ".ssm.conv_kernel"
861865 ssmInnerSizeKey = arch + ".ssm.inner_size"
862866 ssmStateSizeKey = arch + ".ssm.state_size"
@@ -910,6 +914,7 @@ func (gf *GGUFFile) transformerArchitecture(arch string) (ga GGUFArchitecture) {
910914 ropeScalingFactorKey ,
911915 ropeScalingOriginalContextKey ,
912916 ropeScalingFinetunedKey ,
917+ poolingTypeKey ,
913918 ssmConvolutionKernelKey ,
914919 ssmInnerSizeKey ,
915920 ssmStateSizeKey ,
@@ -1098,6 +1103,13 @@ func (gf *GGUFFile) transformerArchitecture(arch string) (ga GGUFArchitecture) {
10981103 ga .RoPEScalingFinetuned = v .ValueBool ()
10991104 }
11001105
1106+ if v , ok := m [poolingTypeKey ]; ok {
1107+ ga .PoolingType = v .ValueUint32 ()
1108+ if ga .AttentionCausal && ga .PoolingType > 2 {
1109+ ga .AttentionCausal = false
1110+ }
1111+ }
1112+
11011113 if v , ok := m [ssmConvolutionKernelKey ]; ok {
11021114 ga .SSMConvolutionKernel = ValueNumeric [uint32 ](v )
11031115 }
0 commit comments