paddlespeech.s2t.models.lm_interface模块
语言模型接口。
- class paddlespeech.s2t.models.lm_interface.LMInterface[来源]
基础:
ScorerInterfaceLM接口模型实现。
方法
add_arguments(parser)向命令行参数解析器添加参数。
build(n_vocab, **kwargs)使用 Python 级别的参数初始化此类。
final_score(state)得分 eos(可选)。
forward(x, t)从缓存序列计算LM损失值。
init_state(x)获取用于解码的初始状态(可选)。
score(y, state, x)评分新令牌(必需)。
select_state(state, i[, new_id])在主光束搜索中选择具有相对ID的状态。