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

[ASR] whisper fix language choice, test=asr #2828

Merged
merged 1 commit into from
Jan 12, 2023
Merged
Changes from all commits
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
2 changes: 1 addition & 1 deletion paddlespeech/s2t/models/whisper/whipser.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ def transcribe(
decode_options["fp16"] = False

if decode_options.get(
"language", 'None') or decode_options.get("language", None) is None:
"language") == 'None' or decode_options.get("language", None) is None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里直接判断 "language" 是否在 decode_options 的 keys 里面就行吧?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不行的, 因为如果用户未指定语种, 他可以按这样传入的参数

whisper_executor(language=None, *args)

那么 "language" 就会出现在 decode_options 的 keys 里面, 所以不能根据 "language" 在不在 decode_options 的 keys 里面来判断

下面是概念验证
image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

if not model.is_multilingual:
decode_options["language"] = "en"
else:
Expand Down