@@ -18,6 +18,7 @@ import (
1818 core "dappco.re/go"
1919 "dappco.re/go/inference/model"
2020 "dappco.re/go/inference/model/gguf"
21+ "dappco.re/go/inference/model/mtp"
2122 "dappco.re/go/inference/model/safetensors"
2223 coreio "dappco.re/go/io"
2324)
@@ -4200,7 +4201,7 @@ func TestNativeAssistantDequantizeTensors_Good(t *testing.T) {
42004201 want := f32ToBf16Slice (wantF32 )
42014202
42024203 m := & AssistantModel {
4203- Config : model .AssistantConfig {Quant : & model.QuantConfig {GroupSize : groupSize , Bits : bits }},
4204+ Config : mtp .AssistantConfig {Quant : & model.QuantConfig {GroupSize : groupSize , Bits : bits }},
42044205 Tensors : map [string ]safetensors.Tensor {
42054206 "layer.weight" : {Dtype : "U32" , Shape : []int {rows , words }, Data : packed },
42064207 "layer.scales" : {Dtype : "BF16" , Shape : []int {rows , cols / groupSize }, Data : scales },
@@ -4238,7 +4239,7 @@ func TestNativeAssistantDequantizeTensors_Bad(t *testing.T) {
42384239 for _ , c := range cases {
42394240 t .Run (c .name , func (t * testing.T ) {
42404241 m := & AssistantModel {
4241- Config : model .AssistantConfig {Quant : & c .quant },
4242+ Config : mtp .AssistantConfig {Quant : & c .quant },
42424243 Tensors : map [string ]safetensors.Tensor {
42434244 "layer.weight" : {Dtype : "U32" , Shape : c .shape , Data : make ([]byte , 4 )},
42444245 "layer.scales" : {Dtype : "BF16" , Shape : []int {1 , 1 }, Data : make ([]byte , 2 )},
@@ -4266,7 +4267,7 @@ func TestNativeAssistantDequantizeTensors_Ugly(t *testing.T) {
42664267 })
42674268 t .Run ("non_affine_mode_is_noop" , func (t * testing.T ) {
42684269 m := & AssistantModel {
4269- Config : model .AssistantConfig {Quant : & model.QuantConfig {Mode : "mxfp4" , GroupSize : 4 , Bits : 4 }},
4270+ Config : mtp .AssistantConfig {Quant : & model.QuantConfig {Mode : "mxfp4" , GroupSize : 4 , Bits : 4 }},
42704271 Tensors : map [string ]safetensors.Tensor {"layer.weight" : untouched },
42714272 }
42724273 if err := nativeAssistantDequantizeTensors (m ); err != nil {
@@ -4278,7 +4279,7 @@ func TestNativeAssistantDequantizeTensors_Ugly(t *testing.T) {
42784279 })
42794280 t .Run ("missing_sibling_is_skipped" , func (t * testing.T ) {
42804281 m := & AssistantModel {
4281- Config : model .AssistantConfig {Quant : & model.QuantConfig {GroupSize : 4 , Bits : 4 }},
4282+ Config : mtp .AssistantConfig {Quant : & model.QuantConfig {GroupSize : 4 , Bits : 4 }},
42824283 Tensors : map [string ]safetensors.Tensor {
42834284 "layer.weight" : untouched ,
42844285 "layer.scales" : {Dtype : "BF16" , Shape : []int {1 , 1 }, Data : make ([]byte , 2 )},
@@ -4294,7 +4295,7 @@ func TestNativeAssistantDequantizeTensors_Ugly(t *testing.T) {
42944295 })
42954296 t .Run ("wrong_rank_is_skipped" , func (t * testing.T ) {
42964297 m := & AssistantModel {
4297- Config : model .AssistantConfig {Quant : & model.QuantConfig {GroupSize : 4 , Bits : 4 }},
4298+ Config : mtp .AssistantConfig {Quant : & model.QuantConfig {GroupSize : 4 , Bits : 4 }},
42984299 Tensors : map [string ]safetensors.Tensor {
42994300 "layer.weight" : {Dtype : "U32" , Shape : []int {4 }, Data : make ([]byte , 4 )},
43004301 "layer.scales" : {Dtype : "BF16" , Shape : []int {1 }, Data : make ([]byte , 2 )},
@@ -4323,9 +4324,9 @@ func TestNativeAssistantLinearInputMatches_Bad(t *testing.T) {
43234324 m * AssistantModel
43244325 }{
43254326 {"quant_nil" , & AssistantModel {}},
4326- {"bits_zero" , & AssistantModel {Config : model .AssistantConfig {Quant : & model.QuantConfig {GroupSize : 4 }}}},
4327+ {"bits_zero" , & AssistantModel {Config : mtp .AssistantConfig {Quant : & model.QuantConfig {GroupSize : 4 }}}},
43274328 {"missing_scales" , & AssistantModel {
4328- Config : model .AssistantConfig {Quant : & model.QuantConfig {GroupSize : 4 , Bits : 4 }},
4329+ Config : mtp .AssistantConfig {Quant : & model.QuantConfig {GroupSize : 4 , Bits : 4 }},
43294330 Tensors : map [string ]safetensors.Tensor {},
43304331 }},
43314332 }
@@ -4342,7 +4343,7 @@ func TestNativeAssistantLinearInputMatches_Ugly(t *testing.T) {
43424343 // bits=4 packs 8 codes/word (packFactor=32/4=8): wantIn=8 divides evenly,
43434344 // so a packed gotIn of wantIn/packFactor=1 word is accepted.
43444345 packed := & AssistantModel {
4345- Config : model .AssistantConfig {Quant : & model.QuantConfig {GroupSize : 4 , Bits : 4 }},
4346+ Config : mtp .AssistantConfig {Quant : & model.QuantConfig {GroupSize : 4 , Bits : 4 }},
43464347 Tensors : map [string ]safetensors.Tensor {"layer.scales" : {Dtype : "BF16" , Data : make ([]byte , 2 )}},
43474348 }
43484349 if ! nativeAssistantLinearInputMatches (packed , "layer" , 1 , 8 ) {
@@ -4351,7 +4352,7 @@ func TestNativeAssistantLinearInputMatches_Ugly(t *testing.T) {
43514352 // bits=3: packFactor=32/3=10 does not divide wantIn=8, so the packer falls
43524353 // back to the byte-packed-row formula gotIn == (wantIn*bits+31)/32.
43534354 fallback := & AssistantModel {
4354- Config : model .AssistantConfig {Quant : & model.QuantConfig {GroupSize : 4 , Bits : 3 }},
4355+ Config : mtp .AssistantConfig {Quant : & model.QuantConfig {GroupSize : 4 , Bits : 3 }},
43554356 Tensors : map [string ]safetensors.Tensor {"layer.scales" : {Dtype : "BF16" , Data : make ([]byte , 2 )}},
43564357 }
43574358 const wantIn = 8
0 commit comments