예제 #1
0
def hello():
    waveglow.load_waveglow_torch('../models/waveglow/waveglow_v5_model.pt')
    # melgan.load_melgan_model(r'E:\githup\zhrtvc\models\vocoder\saved_models\melgan\melgan_multi_speaker.pt',
    #                          args_path=r'E:\githup\zhrtvc\models\vocoder\saved_models\melgan\args.yml')
    melgan.load_melgan_torch('../models/melgan/melgan_multi_speaker_model.pt')

    # mellotron.load_mellotron_model(r'E:\githup\zhrtvc\models\mellotron\samples\checkpoint\checkpoint-000000.pt',
    #                                hparams_path=r'E:\githup\zhrtvc\models\mellotron\samples\metadata\hparams.yml')
    #
    # torch.save(mellotron._model, '../models/mellotron/mellotron_samples_model.pt')
    mellotron.load_mellotron_torch(
        '../models/mellotron/mellotron_samples_model.pt')

    # text, mel, speaker, f0
    text = torch.randint(0, 100, [4, 50]).cuda()
    style = 0  # torch.rand(4, 80, 400).cuda()
    speaker = torch.randint(0, 10, [4]).cuda()
    f0 = None  # torch.rand(4, 400)

    mels = mellotron.generate_mel(text=text,
                                  style=style,
                                  speaker=speaker,
                                  f0=f0)

    for mel in mels:
        print(mel.shape)

    mel = torch.rand(4, 80, 400).cuda()

    wav = waveglow.generate_wave(mel)
    print(wav.shape)
예제 #2
0
def load_models(args):
    if args.waveglow_path:
        waveglow.load_waveglow_torch(args.waveglow_path)
    if args.melgan_path:
        melgan.load_melgan_torch(args.melgan_path)
    if args.mellotron_path:
        mellotron.load_mellotron_torch(args.mellotron_path)