-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Converting Torch to TF 2.0
Currently, we support regular Tacotron2 model in TF 2.0. We do not support advance attention methods and other small tricks used by Torch models. You can convert any Torch model trained after v0.0.2. We also provide a converted TF 2.0 model under the released model page.
It is an initial entry point to TF 2.0 ecosystem. We plan to provide conversion functionality for any model used in Mozilla TTS, including the vocoder models.
Make sure you installed Tensorflow v2.2. It is not installed by default by Mozilla TTS.
All the TF related code stays under tf
folder.
In order to convert a compatible Torch model run the following command with the right arguments.
python convert_tacotron2_torch_to_tf.py\
--torch_model_path /path/to/torch/model.pth.tar \
--config_path /path/to/model/config.json\
--output_path /path/to/output/tf/model
This will create a tf model file. Notice that our model format is not compatible with the official TF checkpoints. We created our custom format to match Torch checkpoints we use. Therefore, use the load_checkpoint
and save_checkpoint
functions provided under TTS.tf.generic_utils
.
The best way to test your TF model is to use the notebook tf/notebooks/Bechmark-TTS_tf.ipynb
.