fix the style issue

This commit is contained in:
Mingshuang Luo 2021-10-13 10:27:16 +08:00
parent 33b88eee2b
commit c8afe05e73

View File

@ -59,7 +59,7 @@ def get_parser():
type=str, type=str,
required=True, required=True,
help="Path to lang bpe dir.", help="Path to lang bpe dir.",
) )
parser.add_argument( parser.add_argument(
"--method", "--method",
@ -325,7 +325,9 @@ def main():
"attention-decoder", "attention-decoder",
]: ]:
logging.info(f"Loading HLG from {params.lang_dir}/HLG.pt") logging.info(f"Loading HLG from {params.lang_dir}/HLG.pt")
HLG = k2.Fsa.from_dict(torch.load(params.lang_dir + "/HLG.pt", map_location="cpu")) HLG = k2.Fsa.from_dict(
torch.load(params.lang_dir + "/HLG.pt", map_location="cpu")
)
HLG = HLG.to(device) HLG = HLG.to(device)
if not hasattr(HLG, "lm_scores"): if not hasattr(HLG, "lm_scores"):
# For whole-lattice-rescoring and attention-decoder # For whole-lattice-rescoring and attention-decoder
@ -390,7 +392,9 @@ def main():
best_path = next(iter(best_path_dict.values())) best_path = next(iter(best_path_dict.values()))
hyps = get_texts(best_path) hyps = get_texts(best_path)
word_sym_table = k2.SymbolTable.from_file(params.lang_dir + "/words.txt") word_sym_table = k2.SymbolTable.from_file(
params.lang_dir + "/words.txt"
)
hyps = [[word_sym_table[i] for i in ids] for ids in hyps] hyps = [[word_sym_table[i] for i in ids] for ids in hyps]
s = "\n" s = "\n"