forked from espnet/espnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request espnet#4149 from brianyan918/fix_st_bug
fix bug in mt/st templates for having separate token lists
- Loading branch information
Showing
4 changed files
with
75 additions
and
4 deletions.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
egs2/TEMPLATE/asr1/scripts/utils/show_translation_result.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/usr/bin/env bash | ||
mindepth=0 | ||
maxdepth=3 | ||
case=tc | ||
|
||
. utils/parse_options.sh | ||
|
||
if [ $# -gt 1 ]; then | ||
echo "Usage: $0 --mindepth 0 --maxdepth 1 [exp]" 1>&2 | ||
echo "" | ||
echo "Show the system environments and the evaluation results in Markdown format." | ||
echo 'The default of <exp> is "exp/".' | ||
exit 1 | ||
fi | ||
|
||
[ -f ./path.sh ] && . ./path.sh | ||
set -euo pipefail | ||
if [ $# -eq 1 ]; then | ||
exp=$1 | ||
else | ||
exp=exp | ||
fi | ||
|
||
|
||
cat << EOF | ||
<!-- Generated by $0 --> | ||
# RESULTS | ||
## Environments | ||
- date: \`$(LC_ALL=C date)\` | ||
EOF | ||
|
||
python3 << EOF | ||
import sys, espnet, torch | ||
pyversion = sys.version.replace('\n', ' ') | ||
print(f"""- python version: \`{pyversion}\` | ||
- espnet version: \`espnet {espnet.__version__}\` | ||
- pytorch version: \`pytorch {torch.__version__}\`""") | ||
EOF | ||
|
||
cat << EOF | ||
- Git hash: \`$(git rev-parse HEAD)\` | ||
- Commit date: \`$(git log -1 --format='%cd')\` | ||
EOF | ||
|
||
metrics="bleu" | ||
|
||
while IFS= read -r expdir; do | ||
if ls "${expdir}"/*/*/score_*/result.${case}.txt &> /dev/null; then | ||
echo "## $(basename ${expdir})" | ||
for type in $metrics; do | ||
cat << EOF | ||
### ${type^^} | ||
|dataset|bleu_score|verbose_score| | ||
|---|---|---| | ||
EOF | ||
data=$(echo "${expdir}"/*/*/score_*/result.${case}.txt | cut -d '/' -f4) | ||
bleu=$(sed -n '5p' "${expdir}"/*/*/score_*/result.${case}.txt | cut -d ' ' -f 3 | tr -d ',') | ||
verbose=$(sed -n '7p' "${expdir}"/*/*/score_*/result.${case}.txt | cut -d ' ' -f 3- | tr -d '",') | ||
echo "${data}|${bleu}|${verbose}" | ||
|
||
done | ||
fi | ||
|
||
done < <(find ${exp} -mindepth ${mindepth} -maxdepth ${maxdepth} -type d) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters