minor updates

This commit is contained in:
jinzr 2023-11-22 17:41:00 +08:00
parent 5074520b88
commit adce588c49
3 changed files with 17 additions and 20 deletions

View File

@ -19,23 +19,20 @@
import argparse import argparse
import inspect import inspect
import logging import logging
from functools import lru_cache
from pathlib import Path from pathlib import Path
from typing import Any, Dict, Optional from typing import Any, Dict, Optional
import torch import torch
from lhotse import CutSet, Fbank, FbankConfig, load_manifest, load_manifest_lazy from lhotse import CutSet, Fbank, FbankConfig, load_manifest
from lhotse.dataset import ( # noqa F401 for PrecomputedFeatures from lhotse.dataset import ( # noqa F401 for PrecomputedFeatures
CutConcatenate, CutConcatenate,
CutMix, CutMix,
DynamicBucketingSampler, DynamicBucketingSampler,
K2SpeechRecognitionDataset, K2SpeechRecognitionDataset,
PrecomputedFeatures,
SimpleCutSampler, SimpleCutSampler,
SpecAugment, SpecAugment,
) )
from lhotse.dataset.input_strategies import ( # noqa F401 For AudioSamples from lhotse.dataset.input_strategies import ( # noqa F401 For AudioSamples
AudioSamples,
OnTheFlyFeatures, OnTheFlyFeatures,
) )
from lhotse.utils import fix_random_seed from lhotse.utils import fix_random_seed

View File

@ -33,7 +33,7 @@ dataset, you should change the argument values according to your dataset.
./zipformer/export.py \ ./zipformer/export.py \
--exp-dir ./zipformer/exp \ --exp-dir ./zipformer/exp \
--tokens data/lang_bpe_2000/tokens.txt \ --tokens data/lang_bbpe_2000/tokens.txt \
--epoch 20 \ --epoch 20 \
--avg 1 \ --avg 1 \
--jit 1 --jit 1
@ -53,7 +53,7 @@ for how to use the exported models outside of icefall.
--causal 1 \ --causal 1 \
--chunk-size 16 \ --chunk-size 16 \
--left-context-frames 128 \ --left-context-frames 128 \
--tokens data/lang_bpe_2000/tokens.txt \ --tokens data/lang_bbpe_2000/tokens.txt \
--epoch 20 \ --epoch 20 \
--avg 1 \ --avg 1 \
--jit 1 --jit 1
@ -72,7 +72,7 @@ for how to use the exported models outside of icefall.
./zipformer/export.py \ ./zipformer/export.py \
--exp-dir ./zipformer/exp \ --exp-dir ./zipformer/exp \
--tokens data/lang_bpe_2000/tokens.txt \ --tokens data/lang_bbpe_2000/tokens.txt \
--epoch 20 \ --epoch 20 \
--avg 1 --avg 1
@ -81,7 +81,7 @@ for how to use the exported models outside of icefall.
./zipformer/export.py \ ./zipformer/export.py \
--exp-dir ./zipformer/exp \ --exp-dir ./zipformer/exp \
--causal 1 \ --causal 1 \
--tokens data/lang_bpe_2000/tokens.txt \ --tokens data/lang_bbpe_2000/tokens.txt \
--epoch 20 \ --epoch 20 \
--avg 1 --avg 1
@ -103,7 +103,7 @@ you can do:
--avg 1 \ --avg 1 \
--max-duration 600 \ --max-duration 600 \
--decoding-method greedy_search \ --decoding-method greedy_search \
--bpe-model data/lang_bpe_2000/bpe.model --bpe-model data/lang_bbpe_2000/bpe.model
- For streaming model: - For streaming model:
@ -124,7 +124,7 @@ To use the generated file with `zipformer/decode.py` and `zipformer/streaming_de
--chunk-size 16 \ --chunk-size 16 \
--left-context-frames 128 \ --left-context-frames 128 \
--decoding-method greedy_search \ --decoding-method greedy_search \
--bpe-model data/lang_bpe_2000/bpe.model --bpe-model data/lang_bbpe_2000/bpe.model
# chunk-wise streaming decoding # chunk-wise streaming decoding
./zipformer/streaming_decode.py \ ./zipformer/streaming_decode.py \
@ -136,7 +136,7 @@ To use the generated file with `zipformer/decode.py` and `zipformer/streaming_de
--chunk-size 16 \ --chunk-size 16 \
--left-context-frames 128 \ --left-context-frames 128 \
--decoding-method greedy_search \ --decoding-method greedy_search \
--bpe-model data/lang_bpe_2000/bpe.model --bpe-model data/lang_bbpe_2000/bpe.model
Check ./pretrained.py for its usage. Check ./pretrained.py for its usage.
@ -251,7 +251,7 @@ def get_parser():
parser.add_argument( parser.add_argument(
"--tokens", "--tokens",
type=str, type=str,
default="data/lang_bpe_2000/tokens.txt", default="data/lang_bbpe_2000/tokens.txt",
help="Path to the tokens.txt", help="Path to the tokens.txt",
) )

View File

@ -25,7 +25,7 @@ dataset, you should change the argument values according to your dataset.
./zipformer/export.py \ ./zipformer/export.py \
--exp-dir ./zipformer/exp \ --exp-dir ./zipformer/exp \
--tokens data/lang_bpe_2000/tokens.txt \ --tokens data/lang_bbpe_2000/tokens.txt \
--epoch 23 \ --epoch 23 \
--avg 1 --avg 1
@ -34,7 +34,7 @@ dataset, you should change the argument values according to your dataset.
./zipformer/export.py \ ./zipformer/export.py \
--exp-dir ./zipformer/exp \ --exp-dir ./zipformer/exp \
--causal 1 \ --causal 1 \
--tokens data/lang_bpe_2000/tokens.txt \ --tokens data/lang_bbpe_2000/tokens.txt \
--epoch 23 \ --epoch 23 \
--avg 1 --avg 1
@ -45,7 +45,7 @@ Usage of this script:
(1) greedy search (1) greedy search
./zipformer/pretrained.py \ ./zipformer/pretrained.py \
--checkpoint ./zipformer/exp/pretrained.pt \ --checkpoint ./zipformer/exp/pretrained.pt \
--tokens data/lang_bpe_2000/tokens.txt \ --tokens data/lang_bbpe_2000/tokens.txt \
--method greedy_search \ --method greedy_search \
/path/to/foo.wav \ /path/to/foo.wav \
/path/to/bar.wav /path/to/bar.wav
@ -53,7 +53,7 @@ Usage of this script:
(2) modified beam search (2) modified beam search
./zipformer/pretrained.py \ ./zipformer/pretrained.py \
--checkpoint ./zipformer/exp/pretrained.pt \ --checkpoint ./zipformer/exp/pretrained.pt \
--tokens ./data/lang_bpe_2000/tokens.txt \ --tokens ./data/lang_bbpe_2000/tokens.txt \
--method modified_beam_search \ --method modified_beam_search \
/path/to/foo.wav \ /path/to/foo.wav \
/path/to/bar.wav /path/to/bar.wav
@ -61,7 +61,7 @@ Usage of this script:
(3) fast beam search (3) fast beam search
./zipformer/pretrained.py \ ./zipformer/pretrained.py \
--checkpoint ./zipformer/exp/pretrained.pt \ --checkpoint ./zipformer/exp/pretrained.pt \
--tokens ./data/lang_bpe_2000/tokens.txt \ --tokens ./data/lang_bbpe_2000/tokens.txt \
--method fast_beam_search \ --method fast_beam_search \
/path/to/foo.wav \ /path/to/foo.wav \
/path/to/bar.wav /path/to/bar.wav
@ -74,7 +74,7 @@ Usage of this script:
--causal 1 \ --causal 1 \
--chunk-size 16 \ --chunk-size 16 \
--left-context-frames 128 \ --left-context-frames 128 \
--tokens ./data/lang_bpe_2000/tokens.txt \ --tokens ./data/lang_bbpe_2000/tokens.txt \
--method greedy_search \ --method greedy_search \
/path/to/foo.wav \ /path/to/foo.wav \
/path/to/bar.wav /path/to/bar.wav
@ -85,7 +85,7 @@ Usage of this script:
--causal 1 \ --causal 1 \
--chunk-size 16 \ --chunk-size 16 \
--left-context-frames 128 \ --left-context-frames 128 \
--tokens ./data/lang_bpe_2000/tokens.txt \ --tokens ./data/lang_bbpe_2000/tokens.txt \
--method modified_beam_search \ --method modified_beam_search \
/path/to/foo.wav \ /path/to/foo.wav \
/path/to/bar.wav /path/to/bar.wav
@ -96,7 +96,7 @@ Usage of this script:
--causal 1 \ --causal 1 \
--chunk-size 16 \ --chunk-size 16 \
--left-context-frames 128 \ --left-context-frames 128 \
--tokens ./data/lang_bpe_2000/tokens.txt \ --tokens ./data/lang_bbpe_2000/tokens.txt \
--method fast_beam_search \ --method fast_beam_search \
/path/to/foo.wav \ /path/to/foo.wav \
/path/to/bar.wav /path/to/bar.wav