Length Adaptor
LengthAdaptor
Bases: Module
DEPRECATED: The LengthAdaptor module is used to adjust the duration of phonemes. It contains a dedicated duration predictor and methods to upsample the input features to match predicted durations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_config |
AcousticModelConfigType
|
The model configuration object containing model parameters. |
required |
Source code in models/tts/delightful_tts/acoustic_model/length_adaptor.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
|
expand(batch, predicted)
Expands the input tensor based on the predicted values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
batch |
Tensor
|
The input tensor. |
required |
predicted |
Tensor
|
The tensor containing predicted expansion factors. |
required |
Returns:
Type | Description |
---|---|
Tensor
|
torch.Tensor: The expanded tensor. |
Source code in models/tts/delightful_tts/acoustic_model/length_adaptor.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
length_regulate(x, duration)
Regulates the length of the input tensor using the duration tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Tensor
|
The input tensor. |
required |
duration |
Tensor
|
The tensor containing duration for each time step in x. |
required |
Returns:
Type | Description |
---|---|
Tuple[Tensor, Tensor]
|
Tuple[torch.Tensor, torch.Tensor]: The regulated output tensor and the tensor containing the length of each sequence in the batch. |
Source code in models/tts/delightful_tts/acoustic_model/length_adaptor.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|
upsample(x, x_res, src_mask, embeddings, control)
Upsamples the input tensor during inference.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Tensor
|
The input tensor. |
required |
x_res |
Tensor
|
Another input tensor for duration prediction. |
required |
src_mask |
Tensor
|
The mask tensor indicating valid entries in x and x_res. |
required |
embeddings |
Tensor
|
The tensor containing phoneme embeddings. |
required |
control |
float
|
A control parameter for pitch regulation. |
required |
Returns:
Type | Description |
---|---|
Tuple[Tensor, Tensor, Tensor]
|
Tuple[torch.Tensor, torch.Tensor, torch.Tensor]: The upsampled x, approximated duration, and upsampled embeddings. |
Source code in models/tts/delightful_tts/acoustic_model/length_adaptor.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
|
upsample_train(x, x_res, duration_target, embeddings, src_mask)
Upsamples the input tensor during training using ground truth durations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Tensor
|
The input tensor. |
required |
x_res |
Tensor
|
Another input tensor for duration prediction. |
required |
duration_target |
Tensor
|
The ground truth durations tensor. |
required |
embeddings |
Tensor
|
The tensor containing phoneme embeddings. |
required |
src_mask |
Tensor
|
The mask tensor indicating valid entries in x and x_res. |
required |
Returns:
Type | Description |
---|---|
Tuple[Tensor, Tensor, Tensor]
|
Tuple[torch.Tensor, torch.Tensor, torch.Tensor]: The upsampled x, log duration prediction, and upsampled embeddings. |
Source code in models/tts/delightful_tts/acoustic_model/length_adaptor.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|