check if cmvn_file in config for u2

pull/1011/head
Hui Zhang 3 years ago
parent ea81c772ce
commit 638b96bf07

@ -1,6 +1,8 @@
# https://yaml.org/type/float.html # https://yaml.org/type/float.html
# network architecture # network architecture
model: model:
cmvn_file:
cmvn_file_type: "json"
# encoder related # encoder related
encoder: transformer encoder: transformer
encoder_conf: encoder_conf:

@ -860,7 +860,7 @@ class U2Model(U2DecodeModel):
int, nn.Layer, nn.Layer, nn.Layer: vocab size, encoder, decoder, ctc int, nn.Layer, nn.Layer, nn.Layer: vocab size, encoder, decoder, ctc
""" """
# cmvn # cmvn
if configs['cmvn_file'] is not None: if 'cmvn_file' in configs and configs['cmvn_file'] is not None:
mean, istd = load_cmvn(configs['cmvn_file'], mean, istd = load_cmvn(configs['cmvn_file'],
configs['cmvn_file_type']) configs['cmvn_file_type'])
global_cmvn = GlobalCMVN( global_cmvn = GlobalCMVN(

Loading…
Cancel
Save