speechbrain.utils.hparams 模块
hparams 文件的实用工具
- 作者
Artem Ploujnikov 2021
摘要
函数
hparams 文件中“switch 语句”的等效功能。 |
参考
- speechbrain.utils.hparams.choice(value, choices, default=None)[source]
hparams 文件中“switch 语句”的等效功能。典型的使用场景是当有不同的选项/模块可用时,通过一个顶层标志来决定使用哪一个
- 参数:
value (any) – 用作标志的值
choices (dict) – 一个字典,将 value 参数的可能值映射到对应的返回值
default (any) – 默认值
- 返回类型:
从 choices 中选择的选项
示例
- model: !new:speechbrain.lobes.models.g2p.model.TransformerG2P
- encoder_emb: !apply:speechbrain.utils.hparams.choice
value: !ref <embedding_type> choices
regular: !ref <encoder_emb> normalized: !ref <encoder_emb_norm>