Comments (16)
Can you provide a code to compare? In my experiment tf is faster. You should check number of parameter รกlso
from tensorflowtts.
experiment is done on single cpu
TensorTTS
i have put a time.time() before and after inference functions
encode time: 2.9387922286987305
decode time: 0.8694911003112793
decode time: 0.3629953861236572
Fastspeech Time Calculation:
6.878948211669922
Melgen Time Calculation:
0.5189647674560547
TTS Time Calculation:
8.024913549423218
Pytorch fastspeech
Fastspeech MEL Calculation:
0.10805535316467285
TTS with squeezewave ouput
4.426220178604126
from tensorflowtts.
Tf run 1 times or loop ? On the first time tf run so slow. You should run around 50
Times and average last 40 times, ignore first 10 times
from tensorflowtts.
i have done this experiment on single cpu
from tensorflowtts.
i have ignored data loading part in time calculation
from tensorflowtts.
i have ignored data loading part in time calculation
Tf run 1 times or loop ? On the first time tf run so slow. You should run around 50
Times and average last 40 times, ignore first 10 times
i have ran it for single time , but time difference is already huge. on cpu*
from tensorflowtts.
Do you run many times and average ?. It does not make any sense for me, tf melgan run 2.5x faster than pytorch melgan. Fs 2x faster too. You must send me a code you use to calculate time.
from tensorflowtts.
import numpy as np
import soundfile as sf
import yaml
import tensorflow as tf
from tensorflow_tts.processor import LJSpeechProcessor
from tensorflow_tts.configs import FastSpeechConfig
from tensorflow_tts.configs import MelGANGeneratorConfig
from tensorflow_tts.models import TFFastSpeech
from tensorflow_tts.models import TFMelGANGenerator
import time
initialize fastspeech model.
with open('./examples/fastspeech/conf/fastspeech.v1.yaml') as f:
fs_config = yaml.load(f, Loader=yaml.Loader)
fs_config = FastSpeechConfig(**fs_config["fastspeech_params"])
fastspeech = TFFastSpeech(config=fs_config, name="fastspeech")
fastspeech._build()
fastspeech.load_weights("./examples/fastspeech/pretrained/model-195000.h5")
initialize melgan model
with open('./examples/melgan/conf/melgan.v1.yaml') as f:
melgan_config = yaml.load(f, Loader=yaml.Loader)
melgan_config = MelGANGeneratorConfig(**melgan_config["generator_params"])
melgan = TFMelGANGenerator(config=melgan_config, name='melgan_generator')
melgan._build()
melgan.load_weights("./examples/melgan/pretrained/generator-280000.h5")
#start = time.time()
inference
processor = LJSpeechProcessor(None, cleaner_names="english_cleaners")
ids = processor.text_to_sequence("do you want me to ask this to alexaa")
ids = tf.expand_dims(ids, 0)
fastspeech inference
start = time.time()
masked_mel_before, masked_mel_after, duration_outputs = fastspeech.inference(
ids,
attention_mask=tf.math.not_equal(ids, 0),
speaker_ids=tf.zeros(shape=[tf.shape(ids)[0]]),
duration_gts=None,
speed_ratios=tf.constant([1.0], dtype=tf.float32)
)
fastspeech = time.time()
print("Fastspeech Time Calculation:")
print(fastspeech-start)
melgan inference
audio_before = melgan(masked_mel_before)[0, :, 0]
audio_after = melgan(masked_mel_after)[0, :, 0]
melgen = time.time()
print("Melgen Time Calculation:")
print(melgen-fastspeech)
save to file
#sf.write('./audio_before.wav', audio_before, 22050, "PCM_16")
sf.write('./audio_after.wav', audio_after, 22050, "PCM_16")
end = time.time()
print("TTS Time Calculation:")
print(end-start)
from tensorflowtts.
encoder decoder time i have put it inside model code
from tensorflowtts.
Command i ran for time calculation == >>> CUDA_VISIBLE_DEVICES=-1 taskset --cpu-list 0 python3 inference.py
from tensorflowtts.
You ran 1 times, it will slow. You should loop and average time, ignore around first 5 iterations.
from tensorflowtts.
sure let me do that
from tensorflowtts.
where did you loop it ? inside script or in bash ?
from tensorflowtts.
Loop inference function on script
from tensorflowtts.
it is comparable now thanks , still pytorch fastspeech time : 0.09 and Tensorflow fastspeech time : 0.19 sec
from tensorflowtts.
i think there is mismatch about parameter config, in my experiment, tf always faster than pytorch. I will let you check the speed :)
from tensorflowtts.
Related Issues (20)
- Multi Speaker Training HOT 1
- Support Arabic Language HOT 2
- Tacotron2 Pre-training have difficulties
- Training Tacotron2 model became so slow after update HOT 1
- How do I get the RTF index HOT 1
- Japanese TTS model HOT 2
- Preprocessing error with ljspeech HOT 6
- tacotron2 parameter confusing, hop size configuration for databaker dataset is 256, not 300 HOT 1
- Installation on MacOS HOT 1
- Hifi-Gan config for Baker dataset HOT 1
- tensorflow-gpu==2.7.0 HOT 15
- Dose it support mutil speaker of chinese language ? HOT 1
- Android release as TTS engine HOT 7
- Train with another dataset HOT 2
- No module named 'tensorflow_tts' HOT 2
- Inference on MB MelGAN sounds great until testing on iOS HOT 3
- TensorFlowTTS support vietnamese HOT 2
- [MB_Melgan] Why is a model trained only generator is better than trained on both?
- support chinese HOT 2
- How to config CMakeLists.txt ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tensorflowtts.