diff --git a/egs/librispeech/ASR/tdnn_lstm_ctc/asr_datamodule.py b/egs/librispeech/ASR/tdnn_lstm_ctc/asr_datamodule.py index 732a842ad..91c1d6a96 100644 --- a/egs/librispeech/ASR/tdnn_lstm_ctc/asr_datamodule.py +++ b/egs/librispeech/ASR/tdnn_lstm_ctc/asr_datamodule.py @@ -1,4 +1,4 @@ -# Copyright 2021 Xiaomi Corp. (authors: Fangjun Kuang) +# Copyright 2021 Piotr Żelasko # # See ../../../../LICENSE for clarification regarding multiple authors # diff --git a/egs/yesno/ASR/local/compute_fbank_yesno.py b/egs/yesno/ASR/local/compute_fbank_yesno.py index a11a3185d..dad7319fd 100755 --- a/egs/yesno/ASR/local/compute_fbank_yesno.py +++ b/egs/yesno/ASR/local/compute_fbank_yesno.py @@ -17,8 +17,9 @@ from lhotse.recipes.utils import read_manifests_if_cached from icefall.utils import get_executor -# Torch's multithreaded behavior needs to be disabled or it wastes a lot of CPU and -# slow things down. Do this outside of main() in case it needs to take effect +# Torch's multithreaded behavior needs to be disabled or it wastes a +# lot of CPU and slow things down. +# Do this outside of main() in case it needs to take effect # even when we are not invoking the main (e.g. when spawning subprocesses). torch.set_num_threads(1) torch.set_num_interop_threads(1) diff --git a/egs/yesno/ASR/tdnn/asr_datamodule.py b/egs/yesno/ASR/tdnn/asr_datamodule.py index 141d34f93..8b2b44c8a 100644 --- a/egs/yesno/ASR/tdnn/asr_datamodule.py +++ b/egs/yesno/ASR/tdnn/asr_datamodule.py @@ -1,14 +1,29 @@ +# Copyright 2021 Piotr Żelasko +# 2021 Xiaomi Corp. (authors: Fangjun Kuang) +# +# See ../../../../LICENSE for clarification regarding multiple authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import argparse import logging from functools import lru_cache from pathlib import Path -from typing import List, Union +from typing import List from lhotse import CutSet, Fbank, FbankConfig, load_manifest from lhotse.dataset import ( BucketingSampler, CutConcatenate, - CutMix, K2SpeechRecognitionDataset, PrecomputedFeatures, SingleCutSampler, diff --git a/egs/yesno/ASR/tdnn/decode.py b/egs/yesno/ASR/tdnn/decode.py index a3df0a632..a87219010 100755 --- a/egs/yesno/ASR/tdnn/decode.py +++ b/egs/yesno/ASR/tdnn/decode.py @@ -3,9 +3,8 @@ import argparse import logging -from collections import defaultdict from pathlib import Path -from typing import Dict, List, Optional, Tuple +from typing import List, Tuple import k2 import torch @@ -14,13 +13,7 @@ from asr_datamodule import YesNoAsrDataModule from model import Tdnn from icefall.checkpoint import average_checkpoints, load_checkpoint -from icefall.decode import ( - get_lattice, - nbest_decoding, - one_best_decoding, - rescore_with_n_best_list, - rescore_with_whole_lattice, -) +from icefall.decode import get_lattice, one_best_decoding from icefall.lexicon import Lexicon from icefall.utils import ( AttributeDict, @@ -243,7 +236,7 @@ def save_results( # ref/hyp pairs. errs_filename = exp_dir / f"errs-{test_set_name}.txt" with open(errs_filename, "w") as f: - wer = write_error_stats(f, f"{test_set_name}", results) + write_error_stats(f, f"{test_set_name}", results) logging.info("Wrote detailed error stats to {}".format(errs_filename)) diff --git a/egs/yesno/ASR/tdnn/train.py b/egs/yesno/ASR/tdnn/train.py index 603085fcd..a5a248c9c 100755 --- a/egs/yesno/ASR/tdnn/train.py +++ b/egs/yesno/ASR/tdnn/train.py @@ -17,7 +17,6 @@ from lhotse.utils import fix_random_seed from model import Tdnn from torch.nn.parallel import DistributedDataParallel as DDP from torch.nn.utils import clip_grad_norm_ -from torch.optim.lr_scheduler import StepLR from torch.utils.tensorboard import SummaryWriter from icefall.checkpoint import load_checkpoint diff --git a/icefall/dataset/datamodule.py b/icefall/dataset/datamodule.py index 97767ef9d..97918ffd8 100644 --- a/icefall/dataset/datamodule.py +++ b/icefall/dataset/datamodule.py @@ -1,4 +1,4 @@ -# Copyright 2021 Xiaomi Corp. (authors: Fangjun Kuang) +# Copyright 2021 Piotr Żelasko # # See ../../LICENSE for clarification regarding multiple authors #