Repository: coqui-ai/TTS

Issue:
[Bug] AttributeError: 'Trainer' object has no attribute 'setup_train_dataloader'
When I try to run the [ljspeech Tacotron2-DDC recipe](https://github.com/coqui-ai/TTS/blob/main/recipes/ljspeech/tacotron2-DDC/run.sh) I get this error:

```
Traceback (most recent call last):
  File "/home/user/repo/coqui-clean/TTS/trainer.py", line 804, in fit
    self._fit()
  File "/home/user/repo/coqui-clean/TTS/trainer.py", line 785, in _fit
    self.callbacks.on_epoch_start()
  File "/home/user/repo/coqui-clean/TTS/utils/callbacks.py", line 28, in on_epoch_start
    self.trainer.model.on_epoch_start(self.trainer)
  File "/home/user/repo/coqui-clean/TTS/tts/models/base_tacotron.py", line 284, in on_epoch_start
    trainer.train_loader = trainer.setup_train_dataloader(self.ap, self.model.decoder.r, verbose=True)
AttributeError: 'Trainer' object has no attribute 'setup_train_dataloader'
```

**To Reproduce**
```
git clone git@github.com:coqui-ai/TTS.git
cd TTS
git checkout 676d22f  # current latest commit
pip install -e .[all,dev,notebooks,tf]
bash recipes/ljspeech/tacotron2-DDC/run.sh
```

**Expected behavior**

It trains successfully.

**Environment (please complete the following information):**
- **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**: Ubuntu 18.04
- **PyTorch or TensorFlow version (use command below)**: 1.9.0
- **Python version**: 3.7.10
- **CUDA/cuDNN version**: 11.1/8005
- **GPU model and memory**: RTX 3090 24GB
- **Exact command to reproduce**: `bash recipes/ljspeech/tacotron2-DDC/run.sh`

**Additional context**

<details>
  <summary>Here's the full output:</summary>

```
(coqui0.1.0) $:~/repo/coqui-clean$ bash recipes/ljspeech/tacotron2-DDC/run.sh
/home/user/repo/coqui-clean/recipes/ljspeech/tacotron2-DDC
--2021-07-06 00:42:41--  http://data.keithito.com/data/speech/LJSpeech-1.1.tar.bz2
Resolving data.keithito.com (data.keithito.com)... 174.138.79.61
Connecting to data.keithito.com (data.keithito.com)|174.138.79.61|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2748572632 (2.6G) [application/octet-stream]
Saving to: ‘LJSpeech-1.1.tar.bz2’
LJSpeech-1.1.tar.bz2
100%[=================================================>]   2.56G  46.6MB/s    in 60s
2021-07-06 00:43:40 (44.0 MB/s) - ‘LJSpeech-1.1.tar.bz2’ saved [2748572632/2748572632]
> Setting up Audio Processor...
| > sample_rate:22050
| > resample:False
| > num_mels:80
| > min_level_db:-100
| > frame_shift_ms:None
| > frame_length_ms:None
| > ref_level_db:20
| > fft_size:1024
| > power:1.5
| > preemphasis:0.0
| > griffin_lim_iters:60
| > signal_norm:False
| > 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
| > base:10
| > hop_length:256
| > win_length:1024
> There are 13100 files.
100%|█████████████████████████████████████████████████████████████████████████████| 13100/13100 [05:46<00:00, 37.81it/s]^N
> Avg mel spec mean: -2.378217084246396
> Avg mel spec scale: 0.7759980543384165
> Avg linear spec mean: -1.5933026157748336
> Avg linear spec scale: 0.871633369603101
> stats saved to /home/user/repo/coqui-clean/recipes/ljspeech/tacotron2-DDC/scale_stats.npy
> Git Hash: 676d22ff
> Experiment folder: /home/user/repo/coqui-clean/recipes/ljspeech/tacotron2-DDC/ljspeech-ddc-July-06-2021_12+52AM-676d22ff
> Using CUDA:  True
> Number of GPUs:  1
> Setting up Audio Processor...
| > sample_rate:22050
| > resample:False
| > num_mels:80
| > min_level_db:-100
| > frame_shift_ms:None
| > frame_length_ms:None
| > ref_level_db:20
| > fft_size:1024
| > power:1.5
| > preemphasis:0.0
| > griffin_lim_iters:60
| > 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:/home/user/repo/coqui-clean/recipes/ljspeech/tacotron2-DDC/scale_stats.npy
| > base:10
| > hop_length:256
| > win_length:1024
| > Found 13100 files in /home/user/repo/coqui-clean/recipes/ljspeech/tacotron2-DDC/LJSpeech-1.1
> Using model: Tacotron2
> Model has 47695604 parameters
! Run is removed from /home/user/repo/coqui-clean/recipes/ljspeech/tacotron2-DDC/ljspeech-ddc-July-06-2021_12+52AM-676d22ff
Traceback (most recent call last):
  File "/home/user/repo/coqui-clean/TTS/trainer.py", line 804, in fit
    self._fit()
  File "/home/user/repo/coqui-clean/TTS/trainer.py", line 785, in _fit
    self.callbacks.on_epoch_start()
  File "/home/user/repo/coqui-clean/TTS/utils/callbacks.py", line 28, in on_epoch_start
    self.trainer.model.on_epoch_start(self.trainer)
  File "/home/user/repo/coqui-clean/TTS/tts/models/base_tacotron.py", line 284, in on_epoch_start
    trainer.train_loader = trainer.setup_train_dataloader(self.ap, self.model.decoder.r, verbose=True)
AttributeError: 'Trainer' object has no attribute 'setup_train_dataloader'
```

</details>


Discussion:
Looks like a real bug. I am on it. 

Resolving patch:
diff --git a/TTS/tts/models/base_tacotron.py b/TTS/tts/models/base_tacotron.py
--- a/TTS/tts/models/base_tacotron.py
+++ b/TTS/tts/models/base_tacotron.py
@@ -281,6 +281,4 @@ def on_epoch_start(self, trainer):
             self.decoder.set_r(r)
             if trainer.config.bidirectional_decoder:
                 trainer.model.decoder_backward.set_r(r)
-            trainer.train_loader = trainer.setup_train_dataloader(self.ap, self.model.decoder.r, verbose=True)
-            trainer.eval_loader = trainer.setup_eval_dataloder(self.ap, self.model.decoder.r)
             print(f"\n > Number of output frames: {self.decoder.r}")


Test patch: