minor fixes for the repo (#1775)

* minor fixes for the repo

Co-authored-by: Fangjun Kuang <csukuangfj@gmail.com>
This commit is contained in:
zr_jin 2024-10-21 13:51:56 +08:00 committed by GitHub
parent e8b6b920c0
commit 88bacfb9e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 6 deletions

View File

@ -22,10 +22,10 @@ import k2
import torch
import torch.nn as nn
from encoder_interface import EncoderInterface
from lhotse.dataset import SpecAugment
from scaling import ScaledLinear
from icefall.utils import add_sos, make_pad_mask, time_warp
from lhotse.dataset import SpecAugment
class AsrModel(nn.Module):

View File

@ -0,0 +1 @@
../../../librispeech/ASR/conformer_ctc/label_smoothing.py

View File

@ -2282,13 +2282,12 @@ def time_warp(
time_warp_factor: Optional[int] = 80,
supervision_segments: Optional[torch.Tensor] = None,
):
"""Apply time warping on a batch of features
"""
"""Apply time warping on a batch of features"""
if time_warp_factor is None or time_warp_factor < 1:
return features
assert len(features.shape) == 3, (
"SpecAugment only supports batches of single-channel feature matrices."
)
assert (
len(features.shape) == 3
), f"SpecAugment only supports batches of single-channel feature matrices. {features.shape}"
features = features.clone()
if supervision_segments is None:
# No supervisions - apply spec augment to full feature matrices.