mstar.model.cosyvoice3.components.onnx_weights#
Weights of the ONNX-only front-end models, loaded into PyTorch modules.
CosyVoice3 ships its speech tokenizer (speech_tokenizer_v3.onnx) and its
speaker encoder (campplus.onnx) as ONNX graphs only. Both are architectures
Chatterbox already implements: the tokenizer is S3Tokenizer with twelve
blocks, the speaker encoder is CAMPPlus. The exporter renamed most weights
(onnx::MatMul_3998), so they are matched by the order the graph uses them
against the order the PyTorch module calls its layers, with every shape
checked. CAMPPlus was exported with each batch norm that follows a convolution
folded into it; such a convolution loads its folded weight and its batch norm
becomes the identity plus the folded bias.
read_onnx decodes just the protobuf fields needed (node inputs and op
types, initializers, Constant values, epsilon), so no onnx
dependency is needed.
Functions
|
|
|
|
|
The nodes, initializers and constants of an ONNX model file. |
Classes
- class mstar.model.cosyvoice3.components.onnx_weights.OnnxGraph(nodes: 'list[OnnxNode]', tensors: 'dict[str, np.ndarray]', initializers: 'frozenset[str]')[source]#
Bases:
object
- class mstar.model.cosyvoice3.components.onnx_weights.OnnxNode(op_type: 'str', inputs: 'list[str]', outputs: 'list[str]', floats: 'dict[str, float]'=<factory>)[source]#
Bases:
object
- mstar.model.cosyvoice3.components.onnx_weights.load_campplus(campplus, path, feat_dim=80)[source]#
campplus.onnx-> Chatterbox’sCAMPPlus; returns the number of convolutions and batch norms loaded.