Skip to content

Style transfer #9

Description

@karkirowle

The bits related to the style transfer experiments are unclear to me. The prosodic control is now represented by the latent space instead of the GST compared to Mellotron/Tacotron 2, but I'm missing how you can project an utterance to the latent space, i.e Section 4.4, especially Section 4.4.4 in the paper.

My guess is the following, and please confirm if that's right:

  • getting z from style utterance ("prior evidence") you do flowtron.forward( mel, speaker_vecs, text, in_lens, out_lens). You do this with the style utterance's transcription. What's the correct way to assign speaker vecs then, if it is an unseen speaker?
  • running flowtron.inference() using that z (residual) from the code.

I tried using the style speaker's id and I found that the style is very nicely represented but the spoken text is gibberish.

I put the style example (angry.wav) and the synthesised example here. The utterance to synth: "How are you today?"

Here is what I changed in inference.py (sorry, my padding solution is criminal):

with torch.no_grad():
        if utterance is None:
            residual = torch.cuda.FloatTensor(1, 80, n_frames).normal_() * sigma
        else:

            utt_text = "Dogs are sitting by the door!"
            utt_text = trainset.get_text(utt_text).cuda()
            utt_text = utt_text[None]

            # loading mel spectra, in_lens, out_lens?
            audio, _ = load_wav_to_torch(utterance)
            mel = trainset.get_mel(audio).to(device="cuda")

            # You need to padd this because of the permute
            mel = mel[None]
            out_lens = torch.LongTensor(1).to(device="cuda")

            out_lens[0] = mel.size(2)
            in_lens = torch.LongTensor([utt_text.shape[1]]).to(device="cuda")
            residual, _, _, _, _, _, _ = model.forward(mel, speaker_vecs, utt_text, in_lens, out_lens)

        residual = residual.permute(1,2,0)
        # TODO: This is a horrible solution to pad once if needed
        if n_frames > residual.shape[2]:
            pad_len = n_frames - residual.shape[2]
            residual = torch.cat((residual,residual[:,:,:pad_len]),axis=2)
        else:
            residual = residual[:,:,:n_frames]

        mels, attentions = model.infer(residual, speaker_vecs, text)


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions