Skip to content

Commit

Permalink
replaced all SingleCutSampler with SimpleCutSampler
Browse files Browse the repository at this point in the history
  • Loading branch information
JinZr committed Sep 13, 2023
1 parent b96fdeb commit cba1f6e
Show file tree
Hide file tree
Showing 20 changed files with 58 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
DynamicBucketingSampler,
K2SpeechRecognitionDataset,
PrecomputedFeatures,
SingleCutSampler,
SimpleCutSampler,
SpecAugment,
)
from lhotse.dataset.input_strategies import OnTheFlyFeatures
Expand Down Expand Up @@ -291,8 +291,8 @@ def train_dataloaders(
drop_last=True,
)
else:
logging.info("Using SingleCutSampler.")
train_sampler = SingleCutSampler(
logging.info("Using SimpleCutSampler.")
train_sampler = SimpleCutSampler(
cuts_train,
max_duration=self.args.max_duration,
shuffle=self.args.shuffle,
Expand Down
6 changes: 3 additions & 3 deletions egs/aishell/ASR/tdnn_lstm_ctc/asr_datamodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
DynamicBucketingSampler,
K2SpeechRecognitionDataset,
PrecomputedFeatures,
SingleCutSampler,
SimpleCutSampler,
SpecAugment,
)
from lhotse.dataset.input_strategies import OnTheFlyFeatures
Expand Down Expand Up @@ -278,8 +278,8 @@ def train_dataloaders(
drop_last=self.args.drop_last,
)
else:
logging.info("Using SingleCutSampler.")
train_sampler = SingleCutSampler(
logging.info("Using SimpleCutSampler.")
train_sampler = SimpleCutSampler(
cuts_train,
max_duration=self.args.max_duration,
shuffle=self.args.shuffle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
DynamicBucketingSampler,
K2SpeechRecognitionDataset,
PrecomputedFeatures,
SingleCutSampler,
SimpleCutSampler,
SpecAugment,
)
from lhotse.dataset.input_strategies import ( # noqa F401 For AudioSamples
Expand Down Expand Up @@ -299,8 +299,8 @@ def train_dataloaders(
drop_last=self.args.drop_last,
)
else:
logging.info("Using SingleCutSampler.")
train_sampler = SingleCutSampler(
logging.info("Using SimpleCutSampler.")
train_sampler = SimpleCutSampler(
cuts_train,
max_duration=self.args.max_duration,
shuffle=self.args.shuffle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
DynamicBucketingSampler,
K2SpeechRecognitionDataset,
PrecomputedFeatures,
SingleCutSampler,
SimpleCutSampler,
SpecAugment,
)
from lhotse.dataset.input_strategies import ( # noqa F401 for AudioSamples
Expand Down Expand Up @@ -310,8 +310,8 @@ def train_dataloaders(
drop_last=self.args.drop_last,
)
else:
logging.info("Using SingleCutSampler.")
train_sampler = SingleCutSampler(
logging.info("Using SimpleCutSampler.")
train_sampler = SimpleCutSampler(
cuts_train,
max_duration=self.args.max_duration,
shuffle=self.args.shuffle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
DynamicBucketingSampler,
K2SpeechRecognitionDataset,
PrecomputedFeatures,
SingleCutSampler,
SimpleCutSampler,
SpecAugment,
)
from lhotse.dataset.input_strategies import OnTheFlyFeatures
Expand Down Expand Up @@ -292,8 +292,8 @@ def train_dataloaders(
drop_last=True,
)
else:
logging.info("Using SingleCutSampler.")
train_sampler = SingleCutSampler(
logging.info("Using SimpleCutSampler.")
train_sampler = SimpleCutSampler(
cuts_train,
max_duration=self.args.max_duration,
shuffle=self.args.shuffle,
Expand Down
2 changes: 1 addition & 1 deletion egs/ami/SURT/dprnn_zipformer/asr_datamodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def train_dataloaders(
drop_last=self.args.drop_last,
)
else:
logging.info("Using SingleCutSampler.")
logging.info("Using SimpleCutSampler.")
train_sampler = SimpleCutSampler(
cuts_train,
max_duration=self.args.max_duration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
DynamicBucketingSampler,
K2SpeechRecognitionDataset,
PrecomputedFeatures,
SingleCutSampler,
SimpleCutSampler,
SpecAugment,
)
from lhotse.dataset.input_strategies import ( # noqa F401 For AudioSamples
Expand Down Expand Up @@ -311,8 +311,8 @@ def train_dataloaders(
drop_last=self.args.drop_last,
)
else:
logging.info("Using SingleCutSampler.")
train_sampler = SingleCutSampler(
logging.info("Using SimpleCutSampler.")
train_sampler = SimpleCutSampler(
cuts_train,
max_duration=self.args.max_duration,
shuffle=self.args.shuffle,
Expand Down
6 changes: 3 additions & 3 deletions egs/csj/ASR/local/utils/asr_datamodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
DynamicBucketingSampler,
K2SpeechRecognitionDataset,
PrecomputedFeatures,
SingleCutSampler,
SimpleCutSampler,
SpecAugment,
)
from lhotse.dataset.input_strategies import ( # noqa F401 For AudioSamples
Expand Down Expand Up @@ -339,8 +339,8 @@ def train_dataloaders(
drop_last=self.args.drop_last,
)
else:
logging.info("Using SingleCutSampler.")
train_sampler = SingleCutSampler(
logging.info("Using SimpleCutSampler.")
train_sampler = SimpleCutSampler(
cuts_train,
max_duration=self.args.max_duration,
shuffle=self.args.shuffle,
Expand Down
6 changes: 3 additions & 3 deletions egs/gigaspeech/ASR/conformer_ctc/asr_datamodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
DynamicBucketingSampler,
K2SpeechRecognitionDataset,
PrecomputedFeatures,
SingleCutSampler,
SimpleCutSampler,
SpecAugment,
)
from lhotse.dataset.input_strategies import OnTheFlyFeatures
Expand Down Expand Up @@ -264,8 +264,8 @@ def train_dataloaders(self, cuts_train: CutSet) -> DataLoader:
drop_last=True,
)
else:
logging.info("Using SingleCutSampler.")
train_sampler = SingleCutSampler(
logging.info("Using SimpleCutSampler.")
train_sampler = SimpleCutSampler(
cuts_train,
max_duration=self.args.max_duration,
shuffle=self.args.shuffle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
DynamicBucketingSampler,
K2SpeechRecognitionDataset,
PrecomputedFeatures,
SingleCutSampler,
SimpleCutSampler,
SpecAugment,
)
from lhotse.dataset.input_strategies import OnTheFlyFeatures
Expand Down Expand Up @@ -297,8 +297,8 @@ def train_dataloaders(
drop_last=True,
)
else:
logging.info("Using SingleCutSampler.")
train_sampler = SingleCutSampler(
logging.info("Using SimpleCutSampler.")
train_sampler = SimpleCutSampler(
cuts_train,
max_duration=self.args.max_duration,
shuffle=self.args.shuffle,
Expand Down
2 changes: 1 addition & 1 deletion egs/libricss/SURT/dprnn_zipformer/asr_datamodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def train_dataloaders(
drop_last=self.args.drop_last,
)
else:
logging.info("Using SingleCutSampler.")
logging.info("Using SimpleCutSampler.")
train_sampler = SimpleCutSampler(
cuts_train,
max_duration=self.args.max_duration,
Expand Down
6 changes: 3 additions & 3 deletions egs/librispeech/ASR/pruned2_knowledge/asr_datamodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
CutMix,
K2SpeechRecognitionDataset,
PrecomputedFeatures,
SingleCutSampler,
SimpleCutSampler,
SpecAugment,
)
from lhotse.dataset.input_strategies import OnTheFlyFeatures
Expand Down Expand Up @@ -290,8 +290,8 @@ def train_dataloaders(
drop_last=True,
)
else:
logging.info("Using SingleCutSampler.")
train_sampler = SingleCutSampler(
logging.info("Using SimpleCutSampler.")
train_sampler = SimpleCutSampler(
cuts_train,
max_duration=self.args.max_duration,
shuffle=self.args.shuffle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
DynamicBucketingSampler,
K2SpeechRecognitionDataset,
PrecomputedFeatures,
SingleCutSampler,
SimpleCutSampler,
SpecAugment,
)
from lhotse.dataset.input_strategies import OnTheFlyFeatures
Expand Down Expand Up @@ -297,8 +297,8 @@ def train_dataloaders(
drop_last=True,
)
else:
logging.info("Using SingleCutSampler.")
train_sampler = SingleCutSampler(
logging.info("Using SimpleCutSampler.")
train_sampler = SimpleCutSampler(
cuts_train,
max_duration=self.args.max_duration,
shuffle=self.args.shuffle,
Expand Down
6 changes: 3 additions & 3 deletions egs/librispeech/ASR/tdnn_lstm_ctc/asr_datamodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
DynamicBucketingSampler,
K2SpeechRecognitionDataset,
PrecomputedFeatures,
SingleCutSampler,
SimpleCutSampler,
SpecAugment,
)
from lhotse.dataset.input_strategies import ( # noqa F401 For AudioSamples
Expand Down Expand Up @@ -314,8 +314,8 @@ def train_dataloaders(
drop_last=self.args.drop_last,
)
else:
logging.info("Using SingleCutSampler.")
train_sampler = SingleCutSampler(
logging.info("Using SimpleCutSampler.")
train_sampler = SimpleCutSampler(
cuts_train,
max_duration=self.args.max_duration,
shuffle=self.args.shuffle,
Expand Down
6 changes: 3 additions & 3 deletions egs/mgb2/ASR/conformer_ctc/asr_datamodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
DynamicBucketingSampler,
K2SpeechRecognitionDataset,
PrecomputedFeatures,
SingleCutSampler,
SimpleCutSampler,
SpecAugment,
)
from lhotse.dataset.input_strategies import OnTheFlyFeatures
Expand Down Expand Up @@ -270,8 +270,8 @@ def train_dataloaders(
drop_last=self.args.drop_last,
)
else:
logging.info("Using SingleCutSampler.")
train_sampler = SingleCutSampler(
logging.info("Using SimpleCutSampler.")
train_sampler = SimpleCutSampler(
cuts_train,
max_duration=self.args.max_duration,
shuffle=self.args.shuffle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
DynamicBucketingSampler,
K2SpeechRecognitionDataset,
PrecomputedFeatures,
SingleCutSampler,
SimpleCutSampler,
SpecAugment,
)
from lhotse.dataset.input_strategies import ( # noqa F401 for AudioSamples
Expand Down Expand Up @@ -311,8 +311,8 @@ def train_dataloaders(
drop_last=self.args.drop_last,
)
else:
logging.info("Using SingleCutSampler.")
train_sampler = SingleCutSampler(
logging.info("Using SimpleCutSampler.")
train_sampler = SimpleCutSampler(
cuts_train,
max_duration=self.args.max_duration,
shuffle=self.args.shuffle,
Expand Down
8 changes: 3 additions & 5 deletions egs/tedlium3/ASR/transducer_stateless/asr_datamodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
CutMix,
DynamicBucketingSampler,
K2SpeechRecognitionDataset,
SingleCutSampler,
SimpleCutSampler,
SpecAugment,
)
from lhotse.dataset.input_strategies import OnTheFlyFeatures
Expand Down Expand Up @@ -259,8 +259,8 @@ def train_dataloaders(
drop_last=True,
)
else:
logging.info("Using SingleCutSampler.")
train_sampler = SingleCutSampler(
logging.info("Using SimpleCutSampler.")
train_sampler = SimpleCutSampler(
cuts_train,
max_duration=self.args.max_duration,
shuffle=self.args.shuffle,
Expand All @@ -282,7 +282,6 @@ def train_dataloaders(
return train_dl

def valid_dataloaders(self, cuts_valid: CutSet) -> DataLoader:

transforms = []
if self.args.concatenate_cuts:
transforms = [
Expand Down Expand Up @@ -322,7 +321,6 @@ def valid_dataloaders(self, cuts_valid: CutSet) -> DataLoader:
return valid_dl

def test_dataloaders(self, cuts_test: CutSet) -> DataLoader:

logging.debug("About to create test dataset")
if self.args.on_the_fly_feats:
test = K2SpeechRecognitionDataset(
Expand Down
10 changes: 5 additions & 5 deletions egs/timit/ASR/tdnn_lstm_ctc/asr_datamodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
DynamicBucketingSampler,
K2SpeechRecognitionDataset,
PrecomputedFeatures,
SingleCutSampler,
SimpleCutSampler,
SpecAugment,
)
from lhotse.dataset.input_strategies import OnTheFlyFeatures
Expand Down Expand Up @@ -225,8 +225,8 @@ def train_dataloaders(self) -> DataLoader:
drop_last=True,
)
else:
logging.info("Using SingleCutSampler.")
train_sampler = SingleCutSampler(
logging.info("Using SimpleCutSampler.")
train_sampler = SimpleCutSampler(
cuts_train,
max_duration=self.args.max_duration,
shuffle=self.args.shuffle,
Expand Down Expand Up @@ -267,7 +267,7 @@ def valid_dataloaders(self) -> DataLoader:
cut_transforms=transforms,
return_cuts=self.args.return_cuts,
)
valid_sampler = SingleCutSampler(
valid_sampler = SimpleCutSampler(
cuts_valid,
max_duration=self.args.max_duration,
shuffle=False,
Expand Down Expand Up @@ -298,7 +298,7 @@ def test_dataloaders(self) -> Union[DataLoader, List[DataLoader]]:
else PrecomputedFeatures(),
return_cuts=self.args.return_cuts,
)
sampler = SingleCutSampler(cuts_test, max_duration=self.args.max_duration)
sampler = SimpleCutSampler(cuts_test, max_duration=self.args.max_duration)
logging.debug("About to create test dataloader")
test_dl = DataLoader(test, batch_size=None, sampler=sampler, num_workers=1)
test_loaders.append(test_dl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
DynamicBucketingSampler,
K2SpeechRecognitionDataset,
PrecomputedFeatures,
SingleCutSampler,
SimpleCutSampler,
SpecAugment,
)
from lhotse.dataset.input_strategies import OnTheFlyFeatures
Expand Down Expand Up @@ -296,8 +296,8 @@ def train_dataloaders(
drop_last=True,
)
else:
logging.info("Using SingleCutSampler.")
train_sampler = SingleCutSampler(
logging.info("Using SimpleCutSampler.")
train_sampler = SimpleCutSampler(
cuts_train,
max_duration=self.args.max_duration,
shuffle=self.args.shuffle,
Expand Down
Loading

0 comments on commit cba1f6e

Please sign in to comment.