Converting a Kaldi Model


Note that OpenVINO support for Kaldi is currently being deprecated and will be removed entirely in the future.


Model conversion API supports the nnet1 and nnet2 formats of Kaldi models. The support of the nnet3 format is limited.

To convert a Kaldi model, run model conversion with the path to the input model .nnet or .mdl file:

mo --input_model <INPUT_MODEL>.nnet

Using Kaldi-Specific Conversion Parameters

The following list provides the Kaldi-specific parameters.

Kaldi-specific parameters:
--counts COUNTS       A file name with full path to the counts file or empty string to utilize count values from the model file
                        Removes the Softmax that is the output layer
--remove_memory       Remove the Memory layer and add new inputs and outputs instead

Examples of CLI Commands

  • To launch model conversion for the wsj_dnn5b_smbr model with the specified .nnet file:

    mo --input_model wsj_dnn5b_smbr.nnet
  • To launch model conversion for the wsj_dnn5b_smbr model with the existing file that contains counts for the last layer with biases:

    mo --input_model wsj_dnn5b_smbr.nnet --counts wsj_dnn5b_smbr.counts
    • The model conversion normalizes сounts in the following way:

      \[S = \frac{1}{\sum_{j = 0}^{|C|}C_{j}}\]

      where \(C\) - the counts array, \(C_{i} - i^{th}\) element of the counts array, \(|C|\) - number of elements in the counts array;

    • The normalized counts are subtracted from biases of the last or next to last layer (if last layer is SoftMax).


      Model conversion API will show a warning if a model contains values of counts and the counts option is not used.

  • If you want to remove the last SoftMax layer in the topology, launch the model conversion with the remove_output_softmax flag:

    mo --input_model wsj_dnn5b_smbr.nnet --counts wsj_dnn5b_smbr.counts --remove_output_softmax

    Model conversion API finds the last layer of the topology and removes this layer only if it is a SoftMax layer.


    Model conversion can remove SoftMax layer only if the topology has one output.

  • You can use the OpenVINO Speech Recognition sample application for the sample inference of Kaldi models. This sample supports models with only one output. If your model has several outputs, specify the desired one with the output option.

Supported Kaldi Layers

For the list of supported standard layers, refer to the Supported Operations page.

Additional Resources

See the Model Conversion Tutorials page for a set of tutorials providing step-by-step instructions for converting specific Kaldi models. Here are some examples: