paddlespeech.t2s.models.waveflow 模块
- class paddlespeech.t2s.models.waveflow.ConditionalWaveFlow(upsample_factors: List[int], n_flows: int, n_layers: int, n_group: int, channels: int, n_mels: int, kernel_size: Union[int, List[int]])[来源]
基础:
LayerListConditionalWaveFlow,一个带有WaveFlow模型的UpsampleNet。
- Args:
- upsample_factors (List[int]):
上采样网络的上采样因子。
- n_flows (int):
WaveFlow模型中的流量数量。
- n_layers (int):
每个流中的残差块数量。
- n_group (int):
折叠为一组的时间步数。
- channels (int):
每个 ResidualBlock 的特征大小。
- n_mels (int):
梅尔谱图的特征大小(梅尔带)。
- kernel_size (Union[int, List[int]]):
每个ResidualBlock中卷积层的核大小。
方法
__call__(*inputs, **kwargs)将self作为一个函数调用。
add_parameter(name, parameter)添加一个参数实例。
add_sublayer(name, sublayer)添加一个子层实例。
append(sublayer)将一个子层附加到列表的末尾。
apply(fn)递归地将
fn应用到每个子层(由.sublayers()返回)以及自身。buffers([include_sublayers])返回当前层及其子层中的所有缓冲区的列表。
children()返回一个迭代器,遍历直接子层。
clear_gradients()清除此层所有参数的梯度。
create_parameter(shape[, attr, dtype, ...])为该层创建参数。
create_tensor([name, persistable, dtype])为该层创建张量。
create_variable([name, persistable, dtype])为该层创建张量。
eval()将该层及其所有子层设置为评估模式。
extend(sublayers)将子层附加到列表的末尾。
extra_repr()该层的额外表示,您可以自定义实现自己的层。
forward(audio, mel)计算变换后的随机变量 z (从 x 到 z) 和从 x 到 z 的变换的雅可比行列式的对数。
from_pretrained(config, checkpoint_path)从预训练模型构建一个ConditionalWaveFlow模型。
full_name()此层的完整名称,由 name_scope + "/" + MyLayer.__class__.__name__ 组成
infer(mel)根据 mel 频谱图生成原始音频。
insert(index, sublayer)在列表中给定索引之前插入一个子层。
load_dict(state_dict[, use_structured_name])从 state_dict 设置参数和可持久化缓存。
named_buffers([prefix, include_sublayers])返回一个迭代器,遍历层中的所有缓冲区,生成名称和张量的元组。
named_children()返回一个直接子层的迭代器,同时提供层的名称和层本身。
named_parameters([prefix, include_sublayers])返回一个迭代器,遍历层中的所有参数,生成名称和参数的元组。
named_sublayers([prefix, include_self, ...])返回Layer中所有子层的迭代器,生成名称和子层的元组。
parameters([include_sublayers])返回当前层及其子层的所有参数的列表。
predict(mel)根据mel谱图生成原始音频。
register_buffer(name, tensor[, persistable])将一个张量注册为该层的缓冲区。
register_forward_post_hook(hook)为层注册一个前向后钩子。
register_forward_pre_hook(hook)为层注册一个前向预钩子。
set_dict(state_dict[, use_structured_name])从 state_dict 设置参数和可持久化的缓冲区。
set_state_dict(state_dict[, use_structured_name])从state_dict设置参数和持久化缓冲区。
state_dict([destination, include_sublayers, ...])获取当前层及其子层的所有参数和可持久化缓冲区。
sublayers([include_self])返回子层的列表。
to([device, dtype, blocking])通过给定的设备、数据类型和阻塞方式转换层的参数和缓冲区。
to_static_state_dict([destination, ...])获取当前层及其子层的所有参数和缓冲区。
train()将此层及其所有子层设置为训练模式。
向后
注册状态字典钩子
- forward(audio, mel)[来源]
计算变换后的随机变量 z (从 x 到 z) 和从 x 到 z 的变换雅可比矩阵的行列式的对数。
- Args:
- audio(Tensor):
音频。形状=(B, T)
- mel(Tensor):
梅尔谱。形状=(B, C_mel, T_mel)
- Returns:
- Tensor:
反向变换的随机变量 z (从 x 到 z)。形状=(B, T)
- Tensor:
从x到z的Jacobian矩阵行列式的对数。形状=(1,)
- classmethod from_pretrained(config, checkpoint_path)[来源]
从预训练模型构建条件波流模型。
- Args:
- config(yacs.config.CfgNode):
模型配置
- checkpoint_path(Path or str):
预训练模型检查点的路径,不带扩展名
- Returns:
ConditionalWaveFlow 从预训练结果构建的模型。
- class paddlespeech.t2s.models.waveflow.WaveFlow(n_flows, n_layers, n_group, channels, mel_bands, kernel_size)[来源]
基础:
LayerList一个由多个自回归流组成的深度可逆层。
- Args:
- n_flows (int):
WaveFlow模型中的流量数量。
- n_layers (int):
每个流中的残差块数量。
- n_group (int):
折叠为一组的时间步数。
- channels (int):
每个 ResidualBlock 的特征大小。
- mel_bands (int):
梅尔谱图的特征大小(梅尔带)。
- kernel_size (Union[int, List[int]]):
每个ResidualBlock中卷积层的核大小。
方法
__call__(*inputs, **kwargs)将self作为一个函数调用。
add_parameter(name, parameter)添加一个参数实例。
add_sublayer(name, sublayer)添加一个子层实例。
append(sublayer)将一个子层附加到列表的末尾。
apply(fn)递归地将
fn应用到每个子层(由.sublayers()返回)以及自身。buffers([include_sublayers])返回当前层及其子层中的所有缓冲区的列表。
children()返回一个迭代器,遍历直接子层。
clear_gradients()清除此层所有参数的梯度。
create_parameter(shape[, attr, dtype, ...])为该层创建参数。
create_tensor([name, persistable, dtype])为该层创建张量。
create_variable([name, persistable, dtype])为该层创建张量。
eval()将该层及其所有子层设置为评估模式。
extend(sublayers)将子层附加到列表的末尾。
extra_repr()该层的额外表示,您可以自定义实现自己的层。
forward(x, condition)在给定条件下,随机变量 x 的概率密度估计。
full_name()此层的完整名称,由 name_scope + "/" + MyLayer.__class__.__name__ 组成
insert(index, sublayer)在列表中给定索引之前插入一个子层。
inverse(z, condition)从分布 p(X) 中抽样。
load_dict(state_dict[, use_structured_name])从 state_dict 设置参数和可持久化缓存。
named_buffers([prefix, include_sublayers])返回一个迭代器,遍历层中的所有缓冲区,生成名称和张量的元组。
named_children()返回一个直接子层的迭代器,同时提供层的名称和层本身。
named_parameters([prefix, include_sublayers])返回一个迭代器,遍历层中的所有参数,生成名称和参数的元组。
named_sublayers([prefix, include_self, ...])返回Layer中所有子层的迭代器,生成名称和子层的元组。
parameters([include_sublayers])返回当前层及其子层的所有参数的列表。
register_buffer(name, tensor[, persistable])将一个张量注册为该层的缓冲区。
register_forward_post_hook(hook)为层注册一个前向后钩子。
register_forward_pre_hook(hook)为层注册一个前向预钩子。
set_dict(state_dict[, use_structured_name])从 state_dict 设置参数和可持久化的缓冲区。
set_state_dict(state_dict[, use_structured_name])从state_dict设置参数和持久化缓冲区。
state_dict([destination, include_sublayers, ...])获取当前层及其子层的所有参数和可持久化缓冲区。
sublayers([include_self])返回子层的列表。
to([device, dtype, blocking])通过给定的设备、数据类型和阻塞方式转换层的参数和缓冲区。
to_static_state_dict([destination, ...])获取当前层及其子层的所有参数和缓冲区。
train()将此层及其所有子层设置为训练模式。
向后
注册状态字典钩子
- class paddlespeech.t2s.models.waveflow.WaveFlowLoss(sigma=1.0)[来源]
基础:
LayerWaveFlow模型的标准。
- Args:
- sigma (float):
WaveFlow中使用的高斯噪声的标准差,默认为1.0。
方法
__call__(*inputs, **kwargs)将self作为一个函数调用。
add_parameter(name, parameter)添加一个参数实例。
add_sublayer(name, sublayer)添加一个子层实例。
apply(fn)递归地将
fn应用到每个子层(由.sublayers()返回)以及自身。buffers([include_sublayers])返回当前层及其子层中的所有缓冲区的列表。
children()返回一个迭代器,遍历直接子层。
clear_gradients()清除此层所有参数的梯度。
create_parameter(shape[, attr, dtype, ...])为该层创建参数。
create_tensor([name, persistable, dtype])为该层创建张量。
create_variable([name, persistable, dtype])为该层创建张量。
eval()将该层及其所有子层设置为评估模式。
extra_repr()该层的额外表示,您可以自定义实现自己的层。
forward(z, log_det_jacobian)计算给定变换后的随机变量 z 和从 x 到 z 的 log_det_jacobian 的损失。
full_name()此层的完整名称,由 name_scope + "/" + MyLayer.__class__.__name__ 组成
load_dict(state_dict[, use_structured_name])从 state_dict 设置参数和可持久化缓存。
named_buffers([prefix, include_sublayers])返回一个迭代器,遍历层中的所有缓冲区,生成名称和张量的元组。
named_children()返回一个直接子层的迭代器,同时提供层的名称和层本身。
named_parameters([prefix, include_sublayers])返回一个迭代器,遍历层中的所有参数,生成名称和参数的元组。
named_sublayers([prefix, include_self, ...])返回Layer中所有子层的迭代器,生成名称和子层的元组。
parameters([include_sublayers])返回当前层及其子层的所有参数的列表。
register_buffer(name, tensor[, persistable])将一个张量注册为该层的缓冲区。
register_forward_post_hook(hook)为层注册一个前向后钩子。
register_forward_pre_hook(hook)为层注册一个前向预钩子。
set_dict(state_dict[, use_structured_name])从 state_dict 设置参数和可持久化的缓冲区。
set_state_dict(state_dict[, use_structured_name])从state_dict设置参数和持久化缓冲区。
state_dict([destination, include_sublayers, ...])获取当前层及其子层的所有参数和可持久化缓冲区。
sublayers([include_self])返回子层的列表。
to([device, dtype, blocking])通过给定的设备、数据类型和阻塞方式转换层的参数和缓冲区。
to_static_state_dict([destination, ...])获取当前层及其子层的所有参数和缓冲区。
train()将此层及其所有子层设置为训练模式。
向后
注册状态字典钩子