Using CUDA: True
Number of GPUs: 1
Experiment folder: /home/yuxin.wang/WorkBench/TTS-master/./bznsyp_models/queue-February-28-2019_02+20PM-1
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
Model restored from step 20000
| > Model has 7000370 parameters
DataLoader initialization
| > Data path: ./BZNSYP/
| > Use phonemes: True
| > phoneme language: zh
| > Cached dataset: False
| > Number of instances : 9000
| > Max length sequence: 52
| > Min length sequence: 5
| > Avg length sequence: 25.88588888888889
| > 0 instances are ignored (0)
| > Batch group shuffling is active.
| > Epoch 0/1000
Traceback (most recent call last):
File "train.py", line 501, in
main(args)
File "train.py", line 439, in main
scheduler, ap, epoch)
File "train.py", line 147, in train
optimizer.step()
File "/home/yuxin.wang/anaconda3/envs/tts/lib/python3.6/site-packages/torch/optim/adam.py", line 93, in step
exp_avg.mul_(beta1).add_(1 - beta1, grad)
RuntimeError: expected type torch.FloatTensor but got torch.cuda.FloatTensor
maybe optimizer.state in cpu and grad in gpu, i fix it by move optimizer initial code to if use_cuda:, like this:
if use_cuda:
model = model.cuda()
criterion.cuda()
criterion_st.cuda()
optimizer = optim.Adam(model.parameters(), lr=c.lr, weight_decay=0)
optimizer.load_state_dict(checkpoint['optimizer'])
optimizer_st = optim.Adam(model.decoder.stopnet.parameters(), lr=c.lr, weight_decay=0)
for state in optimizer.state.values():
for k, v in state.items():
if isinstance(v, torch.Tensor):
state[k] = v.cuda()
Was getting the same error, it was happening when I was loading the checkpoints saved by me previously, resolved it by using .to('cuda') in main() in train.py :
model_t = Tacotron(
num_chars=num_chars,
embedding_dim=c.embedding_size,
linear_dim=ap.num_freq,
mel_dim=ap.num_mels,
r=c.r,
memory_size=c.memory_size)
model = model_t.to('cuda')
Most helpful comment
Was getting the same error, it was happening when I was loading the checkpoints saved by me previously, resolved it by using .to('cuda') in main() in train.py :