question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Convert Multi-band MelGAN pretrained model to TFLite

See original GitHub issue

Hi,

I’m looking to convert the pretrained universal vocoder for Multi-band MelGAN into a TensorFlow Lite .tflite file for use on Android.

I’m trying to convert multiband_melgan.v1_24k (universal vocoder) to be a drop-in replacement for the mbmelgan.tflite (not a universal vocoder) file in the Android example, found here.

As this is a .h5 file, my understanding is I need to go .h5 -> .pb -> .tflite

The problem is, once it reaches load_model, I get the error ValueError: No model found in config file.

Some research says this is because the model was exported with model.save_weights, this way the architecture information is not saved.

Is there any way I can load the architecture information so I can make this conversion? I believe this model was added by @ZDisket

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:20 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
OscarVanLcommented, Oct 20, 2020

Hi, apologies, I worked this out on my own.

I needed to use the MultiBangMelGANGeneratorConfig to load the .yaml config that comes with the model.

My code then becomes:

with open(args.model_config) as conf:
    config = yaml.load(conf, Loader=yaml.Loader)
config = MultiBandMelGANGeneratorConfig(**config['multiband_melgan_generator_params'])
mblemgan = TFMBMelGANGenerator(config=config, name='MBMelGAN')
mblemgan._build()
# Load weights from file
mblemgan.load_weights(args.model_path)
print("Saving model as .pb")
mblemgan.save(os.path.join(args.outdir, filename))

Then you can load this into TFLiteConverter.from_saved_model, run convert() and then write this to a .tflite file 😃

0reactions
OscarVanLcommented, Oct 30, 2020

Nice, glad you got it to work 😃 did you use TF 2.3.1 or TF nightly?

Read more comments on GitHub >

github_iconTop Results From Across the Web

TensorFlowTTS/README.md at master - GitHub
2020/06/07 Multi-band MelGAN (MB MelGAN) implementation with Tensorflow is supported ... TFlite conversion for all supported models. Android example.
Read more >
tensorspeech/tts-mb_melgan-kss-ko - Hugging Face
This repository provides a pretrained Multi-band MelGAN trained on KSS dataset (ko). For a detail of the model, we encourage you to read...
Read more >
TTS download | SourceForge.net
TTS comes with pre-trained models, tools for measuring dataset quality, and is already used in 20+ languages for products and research projects.
Read more >
TTS · PyPI
Speaker Encoder to compute speaker embeddings efficiently. Vocoder models (MelGAN, Multiband-MelGAN, GAN-TTS, ParallelWaveGAN, WaveGrad, WaveRNN). Fast and ...
Read more >
comprise-personal-server - TTS - README.md - GitLab Inria
Support for multi-speaker TTS. Efficient Multi-GPUs training. Ability to convert PyTorch models to Tensorflow 2.0 and TFLite for inference.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found