updated Implementation

This commit is contained in:
RedSheep 2025-03-12 14:25:09 +08:00
parent 04a81f53f0
commit 7a8bc65fe2
3 changed files with 9 additions and 20 deletions

View File

@ -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))

View File

@ -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}",

View File

@ -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