NVIDIA / tacotron2

Tacotron 2 - PyTorch implementation with faster-than-realtime inference
BSD 3-Clause "New" or "Revised" License
5.12k stars 1.39k forks source link

hparams error on colab #626

Open catafest opened 8 months ago

catafest commented 8 months ago

I try to run this colab https://github.com/catafest/colab_google/blob/master/catafest_0059.ipynb , but I got this error:

AttributeError                            Traceback (most recent call last)
<ipython-input-66-474e2af39ea2> in <cell line: 4>()
      2 from hparams import create_hparams
      3 
----> 4 hparams = hparams.create_hparams()
      5 hparams.sampling_rate = 22050
      6 model = Tacotron2(hparams)

/content/tacotron2/hparams.py in create_hparams(hparams_string, verbose)
      6     """Create model hyperparameters. Parse nondefault from given string."""
      7 
----> 8     hparams = tf.training.HParams(
      9         ################################
     10         # Experiment Parameters        #

AttributeError: module 'tensorflow' has no attribute 'contrib'

I try to fix with this , but I got same error:

%cd tacotron2

!tf_upgrade_v2 --intree "/content/tacotron2" --outtree "/content/tacotron2_v2" --reportfile "/content/report.txt"
2024-03-30 20:36:11.334420: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2024-03-30 20:36:11.334480: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2024-03-30 20:36:11.335826: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2024-03-30 20:36:12.772044: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
Output directory '/content/tacotron2_v2' must not already exist.
Abhisitthqgam commented 7 months ago

2 ways to solve the problem 1.https://github.com/NVIDIA/tacotron2/issues/278 2.https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://www.tensorflow.org/tensorboard/hyperparameter_tuning_with_hparams&ved=2ahUKEwjk8fCwoqWFAxXoTWwGHdDYAcEQFnoECCAQAQ&usg=AOvVaw2Qpiv-C_6eSs4CkaJlDa7a I'm not sure the first method will work. Because I got the same error while practicing.

catafest commented 7 months ago

I fix somehow with ...

import tensorflow as tf
from tensorboard.plugins.hparams import api as hp
hparams = hp.hparams
hparams.mask_padding = False
hparams.sampling_rate = 22050
hparams.fp16_run=True
hparams.n_mel_channels=80
hparams.n_frames_per_step=1
hparams.n_symbols = 148
hparams.symbols_embedding_dim = 512
hparams.encoder_n_convolutions = 3
hparams.encoder_embedding_dim = 512
hparams.encoder_kernel_size = 5
hparams.attention_rnn_dim = 1024
hparams.decoder_rnn_dim=1024
hparams.prenet_dim=256
hparams.max_decoder_steps=1000
hparams.gate_threshold=0.5
hparams.p_attention_dropout=0.1
hparams.p_decoder_dropout=0.1
hparams.early_stopping=True
hparams.attention_dim = 128
hparams.attention_location_n_filters=32
hparams.attention_location_kernel_size=31
hparams.n_frames_per_step=1
hparams.decoder_rnn_dim=1024
hparams.prenet_dim=256
hparams.max_decoder_steps=1000
hparams.gate_threshold=0.5
hparams.p_attention_dropout=0.1
hparams.p_decoder_dropout=0.1
hparams.postnet_embedding_dim=512
hparams.postnet_kernel_size=5
hparams.postnet_n_convolutions=5
hparams.decoder_no_early_stopping=False
Abhisitthqgam commented 7 months ago

ฉันจะแก้ไขอย่างใดด้วย ...

import tensorflow as tf
from tensorboard.plugins.hparams import api as hp
hparams = hp.hparams
hparams.mask_padding = False
hparams.sampling_rate = 22050
hparams.fp16_run=True
hparams.n_mel_channels=80
hparams.n_frames_per_step=1
hparams.n_symbols = 148
hparams.symbols_embedding_dim = 512
hparams.encoder_n_convolutions = 3
hparams.encoder_embedding_dim = 512
hparams.encoder_kernel_size = 5
hparams.attention_rnn_dim = 1024
hparams.decoder_rnn_dim=1024
hparams.prenet_dim=256
hparams.max_decoder_steps=1000
hparams.gate_threshold=0.5
hparams.p_attention_dropout=0.1
hparams.p_decoder_dropout=0.1
hparams.early_stopping=True
hparams.attention_dim = 128
hparams.attention_location_n_filters=32
hparams.attention_location_kernel_size=31
hparams.n_frames_per_step=1
hparams.decoder_rnn_dim=1024
hparams.prenet_dim=256
hparams.max_decoder_steps=1000
hparams.gate_threshold=0.5
hparams.p_attention_dropout=0.1
hparams.p_decoder_dropout=0.1
hparams.postnet_embedding_dim=512
hparams.postnet_kernel_size=5
hparams.postnet_n_convolutions=5
hparams.decoder_no_early_stopping=False

Where did you put the Data Parameters?