AttributeError: 'AttrDict' object has no attribute 'gst'

I am trying to synthesize a sentence using the following command

!python /content/TTS/mozilla_voice_tts/bin/synthesize.py “Hello world” “/content/drive/My Drive/parallel_wavegan_config.json” “/content/drive/pwgan-August-26-2020_04+21PM-3424181/checkpoint_690000.pth.tar” “/content/TTS/output” --speaker_fileid 1

Then i receive this error, which i cant find any reference to. What value shoud “gst” be?

2020-08-27 10:19:18.236688: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1

Setting up Audio Processor…
| > sample_rate:22050
| > num_mels:80
| > min_level_db:-100
| > frame_shift_ms:None
| > frame_length_ms:None
| > ref_level_db:0
| > fft_size:1024
| > power:None
| > preemphasis:0.0
| > griffin_lim_iters:None
| > signal_norm:True
| > symmetric_norm:True
| > mel_fmin:50.0
| > mel_fmax:7600.0
| > spec_gain:1.0
| > stft_pad_mode:reflect
| > max_norm:4.0
| > clip_norm:True
| > do_trim_silence:True
| > trim_db:60
| > do_sound_norm:False
| > stats_path:None
| > hop_length:256
| > win_length:1024
Using model: Tacotron2
Traceback (most recent call last):
File “/content/TTS/mozilla_voice_tts/bin/synthesize.py”, line 122, in
model = setup_model(num_chars, num_speakers, C, speaker_embedding_dim)
File “/content/TTS/mozilla_voice_tts/tts/utils/generic_utils.py”, line 84, in setup_model
gst_embedding_dim=c.gst[‘gst_embedding_dim’],
AttributeError: ‘AttrDict’ object has no attribute ‘gst’

You may not have got gst in your config file. Have a look here https://github.com/mozilla/TTS/blob/dev/mozilla_voice_tts/tts/configs/config.json to see the options. I’m guessing you should turn the gst off with use_gst as False (assuming you aren’t trying to use it)

Yes, i am not trying to use it, but when running the command, it ask for it anyway. I did actually set the use_gst as false, before this error appeared

"use_gst": true,       			    // use global style tokens
"gst":	{			                // gst parameter if gst is enabled
    "gst_style_input": null,        // Condition the style input either on a
                                    // -> wave file [path to wave] or
                                    // -> dictionary using the style tokens {'token1': 'value', 'token2': 'value'} example {"0": 0.15, "1": 0.15, "5": -0.15}
                                    // with the dictionary being len(dict) <= len(gst_style_tokens).
    "gst_embedding_dim": 512,
    "gst_num_heads": 4,
    "gst_style_tokens": 10
	},

do you have this part in your config?

No, you are right

I only added parameters as i went along and got error messages. I am not very skilled as a developer (not really a developer at all).

I just had this line
“use_gst”: false, // TACOTRON ONLY: use global style tokens

Okay, found the problem i guess ^^
You need all the parameters in the config, even if you are not going to use them.
Just use the config file Neil linked and adjust it to your needs.

Getting the same error and the link above doesn’t work anymore. Copied the gst params in config.json, rebuilt and tried deploying the server but I get the same error:
Traceback (most recent call last):
File “/usr/lib/python3.8/runpy.py”, line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File “/usr/lib/python3.8/runpy.py”, line 87, in _run_code
exec(code, run_globals)
File “projects/tts/TTS/tacotron2/lib/python3.8/site-packages/TTS/server/server.py”, line 77, in
synthesizer = Synthesizer(args.tts_checkpoint, args.tts_config, args.vocoder_checkpoint, args.vocoder_config, args.use_cuda)
File “projects/tts/TTS/tacotron2/lib/python3.8/site-packages/TTS/utils/synthesizer.py”, line 46, in init
self.load_tts(tts_checkpoint, tts_config,
File “projects/tts/TTS/tacotron2/lib/python3.8/site-packages/TTS/utils/synthesizer.py”, line 92, in load_tts
self.tts_model = setup_model(self.input_size, num_speakers=self.num_speakers, c=self.tts_config)
File “projects/tts/TTS/tacotron2/lib/python3.8/site-packages/TTS/tts/utils/generic_utils.py”, line 85, in setup_model
gst_embedding_dim=c.gst[‘gst_embedding_dim’],
AttributeError: ‘AttrDict’ object has no attribute ‘gst’

Here’s what I copied into the config.json file:

/projects/tts/TTS/tacotron2$ tail -n 25 …/ljspeech-tac2-June-23-2020_01+32PM-ccba431-20210531T025906Z-001/ljspeech-tac2-June-23-2020_01+32PM-ccba431/config.json
“style_wav_for_test”: null, // path to style wav file to be used in TacotronGST inference.
“use_gst”: false, // TACOTRON ONLY: use global style tokens
“gst”: { // gst parameter if gst is enabled
“gst_style_input”: null, // Condition the style input either on a
// -> wave file [path to wave] or
// -> dictionary using the style tokens {‘token1’: ‘value’, ‘token2’: ‘value’} example {“0”: 0.15, “1”: 0.15, “5”: -0.15}
// with the dictionary being len(dict) <= len(gst_style_tokens).
“gst_embedding_dim”: 512,
“gst_num_heads”: 4,
“gst_style_tokens”: 10
},

// DATASETS
"datasets":   // List of datasets. They all merged and they get different speaker_ids.
    [
        {
            "name": "ljspeech",
            "path": "/home/erogol/Data/LJSpeech-1.1/",
            "meta_file_train": "metadata.csv",
            "meta_file_val": null
        }
    ]

}

I did a wget on this file https://raw.githubusercontent.com/mozilla/TTS/master/TTS/tts/configs/config.json and rebuilt and tried running the server again, but still get the same error.

I did a search for all config.json files and updated them to have the gst attributes (namely this: ./tacotron2/lib/python3.8/site-packages/TTS/server/model/tts/config.json) and get this error now:

File “projects/tts/TTS/tacotron2/lib/python3.8/site-packages/torch/serialization.py”, line 308, in _check_seekable
f.seek(f.tell())
AttributeError: ‘NoneType’ object has no attribute ‘seek’