Skip to content

Commit

Permalink
Fix failing tests after repairing docs build (#1138)
Browse files Browse the repository at this point in the history
* Tutorial materials in main readme page

* Fix docs build

* Bump dev version

* Fix missing numpy

* Fix path to VERSION

* Make samplers visible in documentation

* Fix failing tests
  • Loading branch information
pzelasko committed Sep 12, 2023
1 parent 530ad28 commit c6754ff
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions test/dataset/sampling/test_sampler_restoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
CutPairsSampler,
DynamicBucketingSampler,
RoundRobinSampler,
SingleCutSampler,
SimpleCutSampler,
ZipSampler,
)
from lhotse.dataset.sampling.dynamic import DynamicCutSampler
Expand All @@ -23,15 +23,15 @@

# fmt: off
SAMPLERS_TO_TEST = [
# Identically initialized SingleCutSampler
# Identically initialized SimpleCutSampler
lambda: (
SingleCutSampler(CUTS, max_duration=10.0, shuffle=True, drop_last=True),
SingleCutSampler(CUTS, max_duration=10.0, shuffle=True, drop_last=True),
SimpleCutSampler(CUTS, max_duration=10.0, shuffle=True, drop_last=True),
SimpleCutSampler(CUTS, max_duration=10.0, shuffle=True, drop_last=True),
),
# Differently initialized SingleCutSampler with the same CUTS
# Differently initialized SimpleCutSampler with the same CUTS
lambda: (
SingleCutSampler(CUTS, max_duration=10.0, shuffle=True, drop_last=True),
SingleCutSampler(CUTS, max_duration=11.1),
SimpleCutSampler(CUTS, max_duration=10.0, shuffle=True, drop_last=True),
SimpleCutSampler(CUTS, max_duration=11.1),
),
# Differently initialized CutPairsSampler with the same CUTS
lambda: (
Expand All @@ -41,12 +41,12 @@
# Differently initialized ZipSampler with the same CUTS
lambda: (
ZipSampler( # CUTS_SHUF just to randomize the order of the zipped-in cutset
SingleCutSampler(CUTS, max_duration=10.0, shuffle=True, drop_last=True),
SingleCutSampler(CUTS_MOD, max_duration=10.0, shuffle=True, drop_last=True),
SimpleCutSampler(CUTS, max_duration=10.0, shuffle=True, drop_last=True),
SimpleCutSampler(CUTS_MOD, max_duration=10.0, shuffle=True, drop_last=True),
),
ZipSampler(
SingleCutSampler(CUTS, max_duration=11.1),
SingleCutSampler(CUTS_MOD, max_duration=11.1),
SimpleCutSampler(CUTS, max_duration=11.1),
SimpleCutSampler(CUTS_MOD, max_duration=11.1),
),
),
# Differently initialized ZipSampler with the same CUTS (cut pairs)
Expand Down Expand Up @@ -82,12 +82,12 @@
# Differently initialized RoundRobinSampler with the same CUTS
lambda: (
RoundRobinSampler(
SingleCutSampler(CUTS.subset(first=50), max_duration=10.0, shuffle=True, drop_last=True),
SingleCutSampler(CUTS_MOD.subset(first=50), max_duration=10.0, shuffle=True, drop_last=True),
SimpleCutSampler(CUTS.subset(first=50), max_duration=10.0, shuffle=True, drop_last=True),
SimpleCutSampler(CUTS_MOD.subset(first=50), max_duration=10.0, shuffle=True, drop_last=True),
),
RoundRobinSampler(
SingleCutSampler(CUTS.subset(first=50), max_duration=11.1),
SingleCutSampler(CUTS_MOD.subset(first=50), max_duration=11.1),
SimpleCutSampler(CUTS.subset(first=50), max_duration=11.1),
SimpleCutSampler(CUTS_MOD.subset(first=50), max_duration=11.1),
),
),
]
Expand Down Expand Up @@ -226,20 +226,20 @@ def __getitem__(self, item: CutSet) -> List[str]:
@pytest.mark.parametrize(
"create_sampler",
[
lambda: SingleCutSampler(CUTS, max_duration=10.0, shuffle=True, drop_last=True),
lambda: SimpleCutSampler(CUTS, max_duration=10.0, shuffle=True, drop_last=True),
lambda: BucketingSampler(
CUTS, max_duration=10.0, shuffle=True, drop_last=True, num_buckets=2
),
lambda: ZipSampler(
SingleCutSampler(CUTS, max_duration=10.0, shuffle=True, drop_last=True),
SingleCutSampler(CUTS_MOD, max_duration=10.0, shuffle=True, drop_last=True),
SimpleCutSampler(CUTS, max_duration=10.0, shuffle=True, drop_last=True),
SimpleCutSampler(CUTS_MOD, max_duration=10.0, shuffle=True, drop_last=True),
),
lambda: RoundRobinSampler(
# subset to first 50 cuts so that total num batches is 10, not 20
SingleCutSampler(
SimpleCutSampler(
CUTS.subset(first=50), max_duration=10.0, shuffle=True, drop_last=True
),
SingleCutSampler(
SimpleCutSampler(
CUTS_MOD.subset(first=50),
max_duration=10.0,
shuffle=True,
Expand Down

0 comments on commit c6754ff

Please sign in to comment.