speechbrain.utils.hparams 模块

用于hparams文件的实用工具

Authors
  • 阿尔乔姆·普洛日尼科夫 2021

摘要

函数:

choice

相当于hparams文件中的“switch语句”。

参考

speechbrain.utils.hparams.choice(value, choices, default=None)[source]

相当于hparams文件的“switch语句”。典型的使用场景是当有不同的选项/模块可用时,一个顶层标志决定使用哪一个。

Parameters:
  • value (any) – 用作标志的值

  • choices (dict) – 一个字典,将value参数的可能值映射到相应的返回值

  • 默认值 (任意类型) – 默认值

Return type:

从选项中选择的选项

Example

model: !new:speechbrain.lobes.models.g2p.model.TransformerG2P
encoder_emb: !apply:speechbrain.utils.hparams.choice

值: !ref 选项:

常规: !ref 归一化: !ref