Tts: ValueError: zero-size array to reduction operation maximum which has no identity

Created on 6 Apr 2019  路  9Comments  路  Source: mozilla/TTS

i got a few question regarding your codes and really need your help:

AttributeError: Can't get attribute 'extract_mel' on

  1. The above error occur when executing _extract_features.py_. Why is it?

  2. I don't really understand, why we need .json file in order to run this codes.

im sorry if my question is not relevant to you but i really need clarification on this. Since im very new with NLP.

Most helpful comment

@MuruganR96 clearly stated on your configuration:

No. Of Instances: 0

Meaning that, currently, nothing inside your training dataset.

Check your 3 CSV file (metadata, trainmetadata, validmetadata)

Trainmetadata and validmetadata is derived from metadata file which you need to split them properly.

All 9 comments

why do you need extract_features.py? It is not really in use anymore.

json file is to define training parameters like model architecture, learning rate and so on.

  1. basically what is the purpose of having _extract_features.py_ in TTS actually ? im a bit confuse since i'm just follow the given guideline.

  2. which mean, if i don't need to run the _extract_features.py_, then i just proceed with the _train.py_ ?

  3. _python train.py --config_path config.json --data_path ljspeech --output_path trainresult_

    Above is my command to run train.py. But it give an error:

    _FileNotFoundError: [WinError 2] The system cannot find the file specified_

    is my command have gone wrong ?

is config.json exist?

yeah2 sure they exist. Already solved when i run on Ubuntu. Previously i was on Windows. Not sure why it cannot detect.

one more error:

`> Using CUDA: True

Number of GPUs: 1
Git Hash: 4a5056b
Experiment folder: /root/TTS/trainresult/queue-April-08-2019_05+56PM-4a5056b
Setting up Audio Processor...
| > bits:None
| > sample_rate:22050
| > num_mels:80
| > min_level_db:-100
| > frame_shift_ms:12.5
| > frame_length_ms:50
| > ref_level_db:20
| > num_freq:1025
| > power:1.5
| > preemphasis:0.98
| > griffin_lim_iters:60
| > signal_norm:True
| > symmetric_norm:False
| > mel_fmin:0
| > mel_fmax:None
| > max_norm:1.0
| > clip_norm:True
| > do_trim_silence:True
| > n_fft:2048
| > hop_length:275
| > win_length:1102

Model has 7079698 parameters

DataLoader initialization
| > Data path: ljspeech
| > Use phonemes: True
| > phoneme language: en-us
| > Cached dataset: False
| > Number of instances : 0
! Run is removed from /root/TTS/trainresult/queue-April-08-2019_05+56PM-4a5056b
Traceback (most recent call last):
File "train.py", line 561, in
main(args)
File "train.py", line 472, in main
ap, epoch)
File "train.py", line 77, in train
data_loader = setup_loader(is_val=False, verbose=(epoch==0))
File "train.py", line 60, in setup_loader
verbose=verbose)
File "/root/TTS/datasets/TTSDataset.py", line 77, in __init__
self.sort_items()
File "/root/TTS/datasets/TTSDataset.py", line 152, in sort_items
print(" | > Max length sequence: {}".format(np.max(lengths)))
File "/root/miniconda3/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 2505, in amax
initial=initial)
File "/root/miniconda3/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 86, in _wrapreduction
return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
ValueError: zero-size array to reduction operation maximum which has no identity`

  1. Why is it my Instance becomes 0 ?
  2. Why did i get the ValueError? It seems like it don't recognize my dataset.

i put my dataset inside a file named ljspeech. Inside it i got:

  1. metadata.csv,
  2. metadata_train.csv
  3. metadata_val.csv
  4. 13000 wav file.

Check the path of your dataset, if exist and check if you give it right to TTS.

@DrHaqkiem sir how you resolve this issue.? i also facing this issue. but my dataset path correct only.

python3 train.py --data_path /home/dell/Murugan_R/22-04-2019/datasets/en_UK/by_book/female/elizabeth_klett/jane_eyre/mel/ --config_path config.json
 > Using CUDA:  True
 > Number of GPUs:  1
 > Git Hash: 2b970c5
 > Experiment folder: /home/dell/Murugan_R/22-04-2019/pretrained_model/ljspeech_db7f3d3/TTS/mailabs_models/queue-April-24-2019_06+06PM-2b970c5
 > Setting up Audio Processor...
 | > fft size: 2048, hop length: 275, win length: 1102
 | > Audio Processor attributes.
   | > bits:None
   | > sample_rate:22050
   | > num_mels:80
   | > min_level_db:-100
   | > frame_shift_ms:12.5
   | > frame_length_ms:50
   | > ref_level_db:20
   | > num_freq:1025
   | > power:1.5
   | > preemphasis:0.98
   | > griffin_lim_iters:60
   | > signal_norm:True
   | > symmetric_norm:False
   | > mel_fmin:0
   | > mel_fmax:None
   | > max_norm:1.0
   | > clip_norm:True
   | > do_trim_silence:True
   | > n_fft:2048
   | > hop_length:275
   | > win_length:1102
 | > Number of characters : 61
 | > Num output units : 1025

 > Starting a new training
 | > Model has 7000370 parameters
 | > /home/dell/Murugan_R/22-04-2019/datasets/en_UK/by_book/female/elizabeth_klett/jane_eyre/metadata_train.csv
 > DataLoader initialization
 | > Data path: /home/dell/Murugan_R/22-04-2019/datasets/en_UK/by_book/female/elizabeth_klett/jane_eyre/mel/
 | > Use phonemes: True
   | > phoneme language: en-us
 | > Cached dataset: False
 | > Number of instances : 0
 ! Run is removed from /home/dell/Murugan_R/22-04-2019/pretrained_model/ljspeech_db7f3d3/TTS/mailabs_models/queue-April-24-2019_06+06PM-2b970c5
Traceback (most recent call last):
  File "train.py", line 498, in <module>
    main(args)
  File "train.py", line 436, in main
    scheduler, ap, epoch)
  File "train.py", line 68, in train
    data_loader = setup_loader(is_val=False)
  File "train.py", line 53, in setup_loader
    phoneme_language=c.phoneme_language
  File "/home/dell/Murugan_R/22-04-2019/pretrained_model/ljspeech_db7f3d3/TTS/datasets/TTSDataset.py", line 74, in __init__
    self.sort_items()
  File "/home/dell/Murugan_R/22-04-2019/pretrained_model/ljspeech_db7f3d3/TTS/datasets/TTSDataset.py", line 129, in sort_items
    print(" | > Max length sequence: {}".format(np.max(lengths)))
  File "/home/dell/Murugan_R/22-04-2019/pretrained_model/ljspeech_db7f3d3/env/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 2320, in amax
    out=out, **kwargs)
  File "/home/dell/Murugan_R/22-04-2019/pretrained_model/ljspeech_db7f3d3/env/lib/python3.6/site-packages/numpy/core/_methods.py", line 26, in _amax
    return umr_maximum(a, axis, None, out, keepdims)
ValueError: zero-size array to reduction operation maximum which has no identity

any suggestions sir. if i was wrong please correct me. :)

@MuruganR96 clearly stated on your configuration:

No. Of Instances: 0

Meaning that, currently, nothing inside your training dataset.

Check your 3 CSV file (metadata, trainmetadata, validmetadata)

Trainmetadata and validmetadata is derived from metadata file which you need to split them properly.

Thank you @DrHaqkiem sir. I will update my status. :)鈽猴笍鈽猴笍鈽猴笍

Thanks sir. Now fine. i did small mistake here.
previously i tried extract_features.py to generate tts_metadata.csv. but that is not procedure.

first we have to generate train.csv, dev.csv.

shuf metadata.csv > metadata_shuf.csv
head -n 12000 metadata_shuf.csv > train.csv
tail -n 1100 metadata_shuf.csv > val.csv

in config.json, will directly give --data_path for .csv( train.csv, dev.csv).

"data_path": "/datasets/en_UK/by_book/female/elizabeth_klett/jane_eyre/"
"meta_file_train": "train.csv", 
"meta_file_val": "val.csv",  

And then put training.

python3 train.py --data_path /datasets/en_UK/by_book/female/elizabeth_klett/jane_eyre/ --config_path config.json

@DrHaqkiem thank you sir.

Was this page helpful?
0 / 5 - 0 ratings