-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Make type of error rate optional. #193
Conversation
deep_speech_2/evaluate.py
Outdated
type=str, | ||
help="There are total two error rate types including wer and cer. wer " | ||
"represents for word error rate while cer for character error rate. " | ||
"(default: %(default)s)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make the wording concise, e.g. Error rate type for evaluation. 'wer' for word error rate and 'cer' for character error rate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
deep_speech_2/evaluate.py
Outdated
num_ins += 1 | ||
print("WER (%d/?) = %f" % (num_ins, wer_sum / num_ins)) | ||
print("Final WER (%d/%d) = %f" % (num_ins, num_ins, wer_sum / num_ins)) | ||
print("%s (%d/?) = %f" % \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove \
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
deep_speech_2/infer.py
Outdated
else: | ||
error_rate_func = cer | ||
error_rate_info = 'cer' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error_rate_func = cer if args.error_rate_type == 'cer' else wer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
deep_speech_2/evaluate.py
Outdated
@@ -136,7 +145,14 @@ def evaluate(): | |||
rnn_layer_size=args.rnn_layer_size, | |||
pretrained_model_path=args.model_filepath) | |||
|
|||
wer_sum, num_ins = 0.0, 0 | |||
if args.error_rate_type == 'wer': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L148-L153 --> error_rate_func = cer if args.error_rate_type == 'cer' else wer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
deep_speech_2/evaluate.py
Outdated
num_ins += 1 | ||
print("WER (%d/?) = %f" % (num_ins, wer_sum / num_ins)) | ||
print("Final WER (%d/%d) = %f" % (num_ins, num_ins, wer_sum / num_ins)) | ||
print("%s (%d/?) = %f" % \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove error_rate_info
and use print("Error rate [%s] ....." % args.error_rate_type)
for simplicity ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
No description provided.