From 7a8bc65fe2068152a6eb2b94b0fea187bc388587 Mon Sep 17 00:00:00 2001 From: RedSheep Date: Wed, 12 Mar 2025 14:25:09 +0800 Subject: [PATCH] updated Implementation --- egs/librispeech/ASR/chech_version.py | 11 ----------- .../ASR/local/compute_fbank_librispeech.py | 10 +++++----- egs/librispeech/ASR/prepare.sh | 8 ++++---- 3 files changed, 9 insertions(+), 20 deletions(-) delete mode 100755 egs/librispeech/ASR/chech_version.py diff --git a/egs/librispeech/ASR/chech_version.py b/egs/librispeech/ASR/chech_version.py deleted file mode 100755 index ba9383d9d..000000000 --- a/egs/librispeech/ASR/chech_version.py +++ /dev/null @@ -1,11 +0,0 @@ -import torch -import torchaudio - -print("PyTorch version:", torch.__version__) -# print("Torchvision version:", torchvision.__version__) -print("Torchaudio version:", torchaudio.__version__) -print("CUDA available:", torch.cuda.is_available()) -if torch.cuda.is_available(): - print("CUDA version:", torch.version.cuda) - print("cuDNN version:", torch.backends.cudnn.version()) - print("GPU name:", torch.cuda.get_device_name(0)) diff --git a/egs/librispeech/ASR/local/compute_fbank_librispeech.py b/egs/librispeech/ASR/local/compute_fbank_librispeech.py index b41ef8771..ce29ddfdd 100755 --- a/egs/librispeech/ASR/local/compute_fbank_librispeech.py +++ b/egs/librispeech/ASR/local/compute_fbank_librispeech.py @@ -149,18 +149,18 @@ def compute_fbank_librispeech( + cut_set.perturb_speed(0.9) + cut_set.perturb_speed(1.1) ) - # 修改這部分代碼 + if ex is None: - # 為 None 的情況(本地執行)創建自定義進程池上下文 + # Create a custom process pool context for None (local execution) import multiprocessing as mp from concurrent.futures import ProcessPoolExecutor - # 計算工作數 + # Calculate the number of jobs actual_jobs = ( min(num_jobs * 2, 20) if "train" in partition else num_jobs ) - # 使用 forkserver 方法 + # Use the forkserver method ctx = mp.get_context("forkserver") with ProcessPoolExecutor( max_workers=actual_jobs, mp_context=ctx @@ -172,7 +172,7 @@ def compute_fbank_librispeech( storage_type=LilcomChunkyWriter, ) else: - # 分佈式環境,使用提供的執行器 + # Distributed environment, use the provided executor cut_set = cut_set.compute_and_store_features( extractor=extractor, storage_path=f"{output_dir}/{prefix}_feats_{partition}", diff --git a/egs/librispeech/ASR/prepare.sh b/egs/librispeech/ASR/prepare.sh index 45d5a26c2..81f2eac1d 100755 --- a/egs/librispeech/ASR/prepare.sh +++ b/egs/librispeech/ASR/prepare.sh @@ -99,9 +99,9 @@ if [ $stage -le 0 ] && [ $stop_stage -ge 0 ]; then # # ln -sfv /path/to/LibriSpeech $dl_dir/LibriSpeech # - #if [ ! -d $dl_dir/LibriSpeech/train-other-500 ]; then - # lhotse download librispeech --full $dl_dir - #fi + if [ ! -d $dl_dir/LibriSpeech/train-other-500 ]; then + lhotse download librispeech --full $dl_dir + fi # If you have pre-downloaded it to /path/to/musan, # you can create a symlink @@ -139,7 +139,7 @@ if [ $stage -le 3 ] && [ $stop_stage -ge 3 ]; then log "Stage 3: Compute fbank for librispeech" mkdir -p data/fbank if [ ! -e data/fbank/.librispeech.done ]; then - ./local/compute_fbank_librispeech.py --num-workers 4 + ./local/compute_fbank_librispeech.py --num-workers $nj touch data/fbank/.librispeech.done fi