Commit 3b194f68 authored by hwangjeff's avatar hwangjeff Committed by Facebook GitHub Bot
Browse files

Fix LibriSpeech Conforner RNN-T eval script (#2666)

Summary:
`ConformerRNNTModule`'s initializer now accepts a SentencePiece model rather than a path to a model as input. This PR corrects `eval.py` accordingly.

Pull Request resolved: https://github.com/pytorch/audio/pull/2666

Reviewed By: carolineechen

Differential Revision: D39386968

Pulled By: hwangjeff

fbshipit-source-id: 95a94dd898263d648650f7376c29810b1456d6c1
parent 8a0d7b36
...@@ -2,6 +2,8 @@ import logging ...@@ -2,6 +2,8 @@ import logging
import pathlib import pathlib
from argparse import ArgumentParser from argparse import ArgumentParser
import sentencepiece as spm
import torch import torch
import torchaudio import torchaudio
from lightning import ConformerRNNTModule from lightning import ConformerRNNTModule
...@@ -16,7 +18,8 @@ def compute_word_level_distance(seq1, seq2): ...@@ -16,7 +18,8 @@ def compute_word_level_distance(seq1, seq2):
def run_eval(args): def run_eval(args):
model = ConformerRNNTModule.load_from_checkpoint(args.checkpoint_path, sp_model_path=str(args.sp_model_path)).eval() sp_model = spm.SentencePieceProcessor(model_file=str(args.sp_model_path))
model = ConformerRNNTModule.load_from_checkpoint(args.checkpoint_path, sp_model=sp_model).eval()
data_module = get_data_module(str(args.librispeech_path), str(args.global_stats_path), str(args.sp_model_path)) data_module = get_data_module(str(args.librispeech_path), str(args.global_stats_path), str(args.sp_model_path))
if args.use_cuda: if args.use_cuda:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment