Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cli/paraformer] ali-paraformer inference #2067

Merged
merged 21 commits into from
Oct 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
merge main
  • Loading branch information
Mddct committed Oct 30, 2023
commit 0b0eea79fe578cecce76169a9f74bc87fc58d9be
26 changes: 18 additions & 8 deletions wenet/cli/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

import argparse

from wenet.cli.model import Model
from wenet.cli.paraformer_model import Paraformer
from wenet.cli.model import load_model


def get_args():
Expand All @@ -30,19 +29,30 @@ def get_args():
],
default='chinese',
help='language type')
parser.add_argument('--model_dir', default='', help='wenet jit model dirs')

parser.add_argument('-m',
'--model_dir',
default=None,
help='specify your own model dir')
parser.add_argument('-t',
'--show_tokens_info',
action='store_true',
help='whether to output token(word) level information'
', such times/confidence')
parser.add_argument('--align',
action='store_true',
help='force align the input audio and transcript')
parser.add_argument('--label', type=str, help='the input label to align')
args = parser.parse_args()
return args


def main():
args = get_args()
if args.language == 'chinese-paraformer':
model = Paraformer(args.model_dir)
model = load_model(args.language, args.model_dir)
if args.align:
result = model.align(args.audio_file, args.label)
else:
model = Model(args.language)
result = model.transcribe(args.audio_file)
result = model.transcribe(args.audio_file, args.show_tokens_info)
print(result)


Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.