mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-08-10 10:32:17 +00:00
updated Implementation
This commit is contained in:
parent
04a81f53f0
commit
7a8bc65fe2
@ -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))
|
|
@ -149,18 +149,18 @@ def compute_fbank_librispeech(
|
|||||||
+ cut_set.perturb_speed(0.9)
|
+ cut_set.perturb_speed(0.9)
|
||||||
+ cut_set.perturb_speed(1.1)
|
+ cut_set.perturb_speed(1.1)
|
||||||
)
|
)
|
||||||
# 修改這部分代碼
|
|
||||||
if ex is None:
|
if ex is None:
|
||||||
# 為 None 的情況(本地執行)創建自定義進程池上下文
|
# Create a custom process pool context for None (local execution)
|
||||||
import multiprocessing as mp
|
import multiprocessing as mp
|
||||||
from concurrent.futures import ProcessPoolExecutor
|
from concurrent.futures import ProcessPoolExecutor
|
||||||
|
|
||||||
# 計算工作數
|
# Calculate the number of jobs
|
||||||
actual_jobs = (
|
actual_jobs = (
|
||||||
min(num_jobs * 2, 20) if "train" in partition else num_jobs
|
min(num_jobs * 2, 20) if "train" in partition else num_jobs
|
||||||
)
|
)
|
||||||
|
|
||||||
# 使用 forkserver 方法
|
# Use the forkserver method
|
||||||
ctx = mp.get_context("forkserver")
|
ctx = mp.get_context("forkserver")
|
||||||
with ProcessPoolExecutor(
|
with ProcessPoolExecutor(
|
||||||
max_workers=actual_jobs, mp_context=ctx
|
max_workers=actual_jobs, mp_context=ctx
|
||||||
@ -172,7 +172,7 @@ def compute_fbank_librispeech(
|
|||||||
storage_type=LilcomChunkyWriter,
|
storage_type=LilcomChunkyWriter,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# 分佈式環境,使用提供的執行器
|
# Distributed environment, use the provided executor
|
||||||
cut_set = cut_set.compute_and_store_features(
|
cut_set = cut_set.compute_and_store_features(
|
||||||
extractor=extractor,
|
extractor=extractor,
|
||||||
storage_path=f"{output_dir}/{prefix}_feats_{partition}",
|
storage_path=f"{output_dir}/{prefix}_feats_{partition}",
|
||||||
|
@ -99,9 +99,9 @@ if [ $stage -le 0 ] && [ $stop_stage -ge 0 ]; then
|
|||||||
#
|
#
|
||||||
# ln -sfv /path/to/LibriSpeech $dl_dir/LibriSpeech
|
# ln -sfv /path/to/LibriSpeech $dl_dir/LibriSpeech
|
||||||
#
|
#
|
||||||
#if [ ! -d $dl_dir/LibriSpeech/train-other-500 ]; then
|
if [ ! -d $dl_dir/LibriSpeech/train-other-500 ]; then
|
||||||
# lhotse download librispeech --full $dl_dir
|
lhotse download librispeech --full $dl_dir
|
||||||
#fi
|
fi
|
||||||
|
|
||||||
# If you have pre-downloaded it to /path/to/musan,
|
# If you have pre-downloaded it to /path/to/musan,
|
||||||
# you can create a symlink
|
# 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"
|
log "Stage 3: Compute fbank for librispeech"
|
||||||
mkdir -p data/fbank
|
mkdir -p data/fbank
|
||||||
if [ ! -e data/fbank/.librispeech.done ]; then
|
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
|
touch data/fbank/.librispeech.done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user