alexwengg commited on
Commit
b7be41f
·
verified ·
1 Parent(s): 321b18e

Add CamPlusPreprocessor_v2 + CamPlusPlus_v2: Kaldi-exact fbank, exact segment pooling, fp32 (FluidAudio #985)

Browse files

FluidAudio PR https://github.com/FluidInference/FluidAudio/pull/1099 (issue https://github.com/FluidInference/FluidAudio/issues/985); recipe model-lab models/campplus-coreml-v2 (ef06123). Cosine 1.0000 to 3D-Speaker CAMPPlus at all lengths 0.35-60 s; AMI EER 2.85%/3.55% = PyTorch reference. v1 files are unchanged.

CamPlusPlus_v2.mlmodelc/analytics/coremldata.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d0c5e0bf34974549ebc42431a49122d5cc05222a750a864ae53b9d9f625e0d5a
3
+ size 243
CamPlusPlus_v2.mlmodelc/coremldata.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6412f16c728165dfbefce470359665ab94e3c0b7784d25febdd58faed035edab
3
+ size 411
CamPlusPlus_v2.mlmodelc/metadata.json ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "metadataOutputVersion" : "3.0",
4
+ "shortDescription" : "CAM++ speaker embedding (3D-Speaker campplus_cn_common), FluidAudio #985",
5
+ "outputSchema" : [
6
+ {
7
+ "hasShapeFlexibility" : "0",
8
+ "isOptional" : "0",
9
+ "dataType" : "Float32",
10
+ "formattedType" : "MultiArray (Float32 1 × 192)",
11
+ "shortDescription" : "",
12
+ "shape" : "[1, 192]",
13
+ "name" : "embedding",
14
+ "type" : "MultiArray"
15
+ }
16
+ ],
17
+ "storagePrecision" : "Float32",
18
+ "modelParameters" : [
19
+
20
+ ],
21
+ "specificationVersion" : 8,
22
+ "mlProgramOperationTypeHistogram" : {
23
+ "Ios17.square" : 1,
24
+ "Ios17.reshape" : 53,
25
+ "Ios16.reduceMean" : 55,
26
+ "Ios17.transpose" : 1,
27
+ "Ios16.reduceProd" : 1,
28
+ "Ios17.expandDims" : 54,
29
+ "Ios16.avgPool" : 52,
30
+ "Ios17.add" : 56,
31
+ "Tile" : 52,
32
+ "Ios17.sliceByIndex" : 53,
33
+ "Ios16.sigmoid" : 52,
34
+ "Ios17.squeeze" : 1,
35
+ "Shape" : 157,
36
+ "Ios17.gather" : 104,
37
+ "Ios17.batchNorm" : 55,
38
+ "Ios17.conv" : 225,
39
+ "Ios17.sub" : 3,
40
+ "Ios16.relu" : 171,
41
+ "Ios17.cast" : 1,
42
+ "Ios17.realDiv" : 53,
43
+ "Ios17.concat" : 158,
44
+ "Ios17.sqrt" : 1,
45
+ "Ios17.mul" : 54
46
+ },
47
+ "computePrecision" : "Mixed (Float32, Int32)",
48
+ "isUpdatable" : "0",
49
+ "stateSchema" : [
50
+
51
+ ],
52
+ "availability" : {
53
+ "macOS" : "14.0",
54
+ "tvOS" : "17.0",
55
+ "visionOS" : "1.0",
56
+ "watchOS" : "10.0",
57
+ "iOS" : "17.0",
58
+ "macCatalyst" : "17.0"
59
+ },
60
+ "modelType" : {
61
+ "name" : "MLModelType_mlProgram"
62
+ },
63
+ "inputSchema" : [
64
+ {
65
+ "dataType" : "Float32",
66
+ "hasShapeFlexibility" : "1",
67
+ "isOptional" : "0",
68
+ "shapeFlexibility" : "1 × 32...5998 × 80",
69
+ "shapeRange" : "[[1, 1], [32, 5998], [80, 80]]",
70
+ "formattedType" : "MultiArray (Float32 1 × 400 × 80)",
71
+ "type" : "MultiArray",
72
+ "shape" : "[1, 400, 80]",
73
+ "name" : "feats",
74
+ "shortDescription" : ""
75
+ }
76
+ ],
77
+ "userDefinedMetadata" : {
78
+ "com.github.apple.coremltools.source_dialect" : "TorchScript",
79
+ "com.github.apple.coremltools.source" : "torch==2.5.1",
80
+ "com.github.apple.coremltools.version" : "8.3.0"
81
+ },
82
+ "generatedClassName" : "CamPlusPlus_v2",
83
+ "method" : "predict"
84
+ }
85
+ ]
CamPlusPlus_v2.mlmodelc/model.mil ADDED
The diff for this file is too large to render. See raw diff
 
CamPlusPlus_v2.mlmodelc/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3e5bafbc3d3faa94aff8c72afd22ffae97ce31d87ce70c000585e055cd776c18
3
+ size 27670272
CamPlusPreprocessor_v2.mlmodelc/analytics/coremldata.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:79a870e41d4cb1681d8a6d971f6df7958c06b7532ff5dfe7a6d554a5c18a775d
3
+ size 243
CamPlusPreprocessor_v2.mlmodelc/coremldata.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a455197a14ef8f53a4ef8bc10a0b255660c124618b0c256b8b158896c3bb0e3d
3
+ size 384
CamPlusPreprocessor_v2.mlmodelc/metadata.json ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "metadataOutputVersion" : "3.0",
4
+ "shortDescription" : "CAM++ Kaldi fbank (Povey, dither 0), FluidAudio #985",
5
+ "outputSchema" : [
6
+ {
7
+ "hasShapeFlexibility" : "0",
8
+ "isOptional" : "0",
9
+ "dataType" : "Float32",
10
+ "formattedType" : "MultiArray (Float32)",
11
+ "shortDescription" : "",
12
+ "shape" : "[]",
13
+ "name" : "features",
14
+ "type" : "MultiArray"
15
+ }
16
+ ],
17
+ "storagePrecision" : "Float32",
18
+ "modelParameters" : [
19
+
20
+ ],
21
+ "specificationVersion" : 8,
22
+ "mlProgramOperationTypeHistogram" : {
23
+ "Ios17.clip" : 1,
24
+ "Ios17.conv" : 1,
25
+ "Ios17.log" : 1,
26
+ "Ios17.mul" : 2,
27
+ "Ios17.sliceByIndex" : 2,
28
+ "Ios17.matmul" : 1,
29
+ "Ios17.add" : 1,
30
+ "Ios17.transpose" : 1,
31
+ "Ios17.expandDims" : 1
32
+ },
33
+ "computePrecision" : "Mixed (Float32, Int32)",
34
+ "isUpdatable" : "0",
35
+ "stateSchema" : [
36
+
37
+ ],
38
+ "availability" : {
39
+ "macOS" : "14.0",
40
+ "tvOS" : "17.0",
41
+ "visionOS" : "1.0",
42
+ "watchOS" : "10.0",
43
+ "iOS" : "17.0",
44
+ "macCatalyst" : "17.0"
45
+ },
46
+ "modelType" : {
47
+ "name" : "MLModelType_mlProgram"
48
+ },
49
+ "inputSchema" : [
50
+ {
51
+ "dataType" : "Float32",
52
+ "hasShapeFlexibility" : "1",
53
+ "isOptional" : "0",
54
+ "shapeFlexibility" : "1 × 400...960000",
55
+ "shapeRange" : "[[1, 1], [400, 960000]]",
56
+ "formattedType" : "MultiArray (Float32 1 × 64000)",
57
+ "type" : "MultiArray",
58
+ "shape" : "[1, 64000]",
59
+ "name" : "waveform",
60
+ "shortDescription" : ""
61
+ }
62
+ ],
63
+ "userDefinedMetadata" : {
64
+ "com.github.apple.coremltools.source_dialect" : "TorchScript",
65
+ "com.github.apple.coremltools.version" : "8.3.0",
66
+ "com.github.apple.coremltools.source" : "torch==2.5.1"
67
+ },
68
+ "generatedClassName" : "CamPlusPreprocessor_v2",
69
+ "method" : "predict"
70
+ }
71
+ ]
CamPlusPreprocessor_v2.mlmodelc/model.mil ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ program(1.0)
2
+ [buildInfo = dict<tensor<string, []>, tensor<string, []>>({{"coremlc-component-MIL", "3600.16.1"}, {"coremlc-version", "3600.25.1"}, {"coremltools-component-torch", "2.5.1"}, {"coremltools-source-dialect", "TorchScript"}, {"coremltools-version", "8.3.0"}})]
3
+ {
4
+ func main<ios17>(tensor<fp32, [1, ?]> waveform) [FlexibleShapeInformation = tuple<tuple<tensor<string, []>, dict<tensor<string, []>, tensor<int32, [?]>>>, tuple<tensor<string, []>, dict<tensor<string, []>, list<tensor<int32, [2]>, ?>>>>((("DefaultShapes", {{"waveform", [1, 64000]}}), ("RangeDims", {{"waveform", [[1, 1], [400, 960000]]}})))] {
5
+ tensor<fp32, [80, 257]> mel = const()[name = tensor<string, []>("mel"), val = tensor<fp32, [80, 257]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(64)))];
6
+ tensor<fp32, [514, 1, 400]> kernel = const()[name = tensor<string, []>("kernel"), val = tensor<fp32, [514, 1, 400]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(82368)))];
7
+ tensor<int32, [1]> var_10_axes_0 = const()[name = tensor<string, []>("op_10_axes_0"), val = tensor<int32, [1]>([1])];
8
+ tensor<fp32, [1, 1, ?]> var_10 = expand_dims(axes = var_10_axes_0, x = waveform)[name = tensor<string, []>("op_10")];
9
+ tensor<string, []> spec_pad_type_0 = const()[name = tensor<string, []>("spec_pad_type_0"), val = tensor<string, []>("valid")];
10
+ tensor<int32, [1]> spec_strides_0 = const()[name = tensor<string, []>("spec_strides_0"), val = tensor<int32, [1]>([160])];
11
+ tensor<int32, [2]> spec_pad_0 = const()[name = tensor<string, []>("spec_pad_0"), val = tensor<int32, [2]>([0, 0])];
12
+ tensor<int32, [1]> spec_dilations_0 = const()[name = tensor<string, []>("spec_dilations_0"), val = tensor<int32, [1]>([1])];
13
+ tensor<int32, []> spec_groups_0 = const()[name = tensor<string, []>("spec_groups_0"), val = tensor<int32, []>(1)];
14
+ tensor<fp32, [1, 514, ?]> spec = conv(dilations = spec_dilations_0, groups = spec_groups_0, pad = spec_pad_0, pad_type = spec_pad_type_0, strides = spec_strides_0, weight = kernel, x = var_10)[name = tensor<string, []>("spec")];
15
+ tensor<int32, [3]> re_begin_0 = const()[name = tensor<string, []>("re_begin_0"), val = tensor<int32, [3]>([0, 0, 0])];
16
+ tensor<int32, [3]> re_end_0 = const()[name = tensor<string, []>("re_end_0"), val = tensor<int32, [3]>([1, 257, 0])];
17
+ tensor<bool, [3]> re_end_mask_0 = const()[name = tensor<string, []>("re_end_mask_0"), val = tensor<bool, [3]>([true, false, true])];
18
+ tensor<fp32, [1, 257, ?]> re = slice_by_index(begin = re_begin_0, end = re_end_0, end_mask = re_end_mask_0, x = spec)[name = tensor<string, []>("re")];
19
+ tensor<int32, [3]> im_begin_0 = const()[name = tensor<string, []>("im_begin_0"), val = tensor<int32, [3]>([0, 257, 0])];
20
+ tensor<int32, [3]> im_end_0 = const()[name = tensor<string, []>("im_end_0"), val = tensor<int32, [3]>([1, 514, 0])];
21
+ tensor<bool, [3]> im_end_mask_0 = const()[name = tensor<string, []>("im_end_mask_0"), val = tensor<bool, [3]>([true, true, true])];
22
+ tensor<fp32, [1, 257, ?]> im = slice_by_index(begin = im_begin_0, end = im_end_0, end_mask = im_end_mask_0, x = spec)[name = tensor<string, []>("im")];
23
+ tensor<fp32, [1, 257, ?]> var_52 = mul(x = re, y = re)[name = tensor<string, []>("op_52")];
24
+ tensor<fp32, [1, 257, ?]> var_53 = mul(x = im, y = im)[name = tensor<string, []>("op_53")];
25
+ tensor<fp32, [1, 257, ?]> power = add(x = var_52, y = var_53)[name = tensor<string, []>("power")];
26
+ tensor<bool, []> mel_1_transpose_x_0 = const()[name = tensor<string, []>("mel_1_transpose_x_0"), val = tensor<bool, []>(false)];
27
+ tensor<bool, []> mel_1_transpose_y_0 = const()[name = tensor<string, []>("mel_1_transpose_y_0"), val = tensor<bool, []>(false)];
28
+ tensor<fp32, [1, 80, ?]> mel_1 = matmul(transpose_x = mel_1_transpose_x_0, transpose_y = mel_1_transpose_y_0, x = mel, y = power)[name = tensor<string, []>("mel_1")];
29
+ tensor<fp32, []> var_57 = const()[name = tensor<string, []>("op_57"), val = tensor<fp32, []>(0x1p-23)];
30
+ tensor<fp32, []> const_0 = const()[name = tensor<string, []>("const_0"), val = tensor<fp32, []>(0x1.fffffep+127)];
31
+ tensor<fp32, [1, 80, ?]> clip_0 = clip(alpha = var_57, beta = const_0, x = mel_1)[name = tensor<string, []>("clip_0")];
32
+ tensor<fp32, []> var_60_epsilon_0 = const()[name = tensor<string, []>("op_60_epsilon_0"), val = tensor<fp32, []>(0x1p-149)];
33
+ tensor<fp32, [1, 80, ?]> var_60 = log(epsilon = var_60_epsilon_0, x = clip_0)[name = tensor<string, []>("op_60")];
34
+ tensor<int32, [3]> var_63_perm_0 = const()[name = tensor<string, []>("op_63_perm_0"), val = tensor<int32, [3]>([0, 2, 1])];
35
+ tensor<fp32, [1, ?, 80]> features = transpose(perm = var_63_perm_0, x = var_60)[name = tensor<string, []>("transpose_0")];
36
+ } -> (features);
37
+ }
CamPlusPreprocessor_v2.mlmodelc/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:24c77ee75e17819622b3a69eeaccd57c6f6f05b0f5747c807a6540f032d3f1fb
3
+ size 904832