From d80ac2fd2df4e7fb8a28acfa512bb11472b5cc99 Mon Sep 17 00:00:00 2001
From: liugz18 <57401541+liugz18@users.noreply.github.com>
Date: 星期四, 18 七月 2024 21:34:55 +0800
Subject: [PATCH] Rename 'res' in line 514 to avoid with naming conflict with line 365
---
funasr/models/specaug/specaug.py | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/funasr/models/specaug/specaug.py b/funasr/models/specaug/specaug.py
index 49f83e2..75a4b0b 100644
--- a/funasr/models/specaug/specaug.py
+++ b/funasr/models/specaug/specaug.py
@@ -1,4 +1,5 @@
"""SpecAugment module."""
+
from typing import Optional
from typing import Sequence
from typing import Union
@@ -10,6 +11,7 @@
from funasr.register import tables
import torch.nn as nn
+
@tables.register("specaug_classes", "SpecAug")
class SpecAug(nn.Module):
@@ -40,9 +42,7 @@
num_time_mask: int = 2,
):
if not apply_time_warp and not apply_time_mask and not apply_freq_mask:
- raise ValueError(
- "Either one of time_warp, time_mask, or freq_mask should be applied"
- )
+ raise ValueError("Either one of time_warp, time_mask, or freq_mask should be applied")
if (
apply_time_mask
and (time_mask_width_range is not None)
@@ -101,6 +101,7 @@
x, x_lengths = self.time_mask(x, x_lengths)
return x, x_lengths
+
@tables.register("specaug_classes", "SpecAugLFR")
class SpecAugLFR(nn.Module):
"""Implementation of SpecAug.
@@ -122,9 +123,7 @@
num_time_mask: int = 2,
):
if not apply_time_warp and not apply_time_mask and not apply_freq_mask:
- raise ValueError(
- "Either one of time_warp, time_mask, or freq_mask should be applied"
- )
+ raise ValueError("Either one of time_warp, time_mask, or freq_mask should be applied")
if (
apply_time_mask
and (time_mask_width_range is not None)
@@ -149,7 +148,7 @@
dim="freq",
mask_width_range=freq_mask_width_range,
num_mask=num_freq_mask,
- lfr_rate=lfr_rate+1,
+ lfr_rate=lfr_rate + 1,
)
else:
@@ -184,4 +183,4 @@
x, x_lengths = self.freq_mask(x, x_lengths)
if self.time_mask is not None:
x, x_lengths = self.time_mask(x, x_lengths)
- return x, x_lengths
\ No newline at end of file
+ return x, x_lengths
--
Gitblit v1.9.1