mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-08-10 18:42:19 +00:00
Merge branch 'k2-fsa:master' into dev/k2ssl
This commit is contained in:
commit
c9207356af
@ -22,10 +22,10 @@ import k2
|
|||||||
import torch
|
import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
from encoder_interface import EncoderInterface
|
from encoder_interface import EncoderInterface
|
||||||
|
from lhotse.dataset import SpecAugment
|
||||||
from scaling import ScaledLinear
|
from scaling import ScaledLinear
|
||||||
|
|
||||||
from icefall.utils import add_sos, make_pad_mask, time_warp
|
from icefall.utils import add_sos, make_pad_mask, time_warp
|
||||||
from lhotse.dataset import SpecAugment
|
|
||||||
|
|
||||||
|
|
||||||
class AsrModel(nn.Module):
|
class AsrModel(nn.Module):
|
||||||
|
1
egs/speech_llm/ASR_LLM/whisper_llm_zh/label_smoothing.py
Symbolic link
1
egs/speech_llm/ASR_LLM/whisper_llm_zh/label_smoothing.py
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../librispeech/ASR/conformer_ctc/label_smoothing.py
|
@ -2282,13 +2282,12 @@ def time_warp(
|
|||||||
time_warp_factor: Optional[int] = 80,
|
time_warp_factor: Optional[int] = 80,
|
||||||
supervision_segments: Optional[torch.Tensor] = None,
|
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:
|
if time_warp_factor is None or time_warp_factor < 1:
|
||||||
return features
|
return features
|
||||||
assert len(features.shape) == 3, (
|
assert (
|
||||||
"SpecAugment only supports batches of single-channel feature matrices."
|
len(features.shape) == 3
|
||||||
)
|
), f"SpecAugment only supports batches of single-channel feature matrices. {features.shape}"
|
||||||
features = features.clone()
|
features = features.clone()
|
||||||
if supervision_segments is None:
|
if supervision_segments is None:
|
||||||
# No supervisions - apply spec augment to full feature matrices.
|
# No supervisions - apply spec augment to full feature matrices.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user