Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor CutSet.describe to enable parallel statistics computation #1168

Merged
merged 1 commit into from
Sep 29, 2023

Conversation

pzelasko
Copy link
Collaborator

Resolves #1167. Below is a toy example showing how to use this with multiple cut sets (for simplicity, I'm replicating an existing one here).

from lhotse import CutSet
from lhotse.cut.describe import CutSetStatistics
from concurrent.futures import ProcessPoolExecutor


def work(cs): return CutSetStatistics().accumulate(cs)

if __name__ == "__main__":
    cuts = CutSet.from_file("libri-train-5.jsonl.gz")

    print("Sequential")
    cuts.repeat(100).describe()

    print("Parallel")
    with ProcessPoolExecutor(8) as ex:
        stats = list(ex.map(
            work,
            [cuts] * 100,
        ))
    stats = stats[0].combine(*stats[1:])
    stats.describe()

@pzelasko pzelasko added this to the v1.17 milestone Sep 29, 2023
@pzelasko pzelasko merged commit 81e5c4b into master Sep 29, 2023
10 checks passed
@pzelasko pzelasko deleted the feature/modular-describe branch September 29, 2023 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Slow CutSet.describe()
1 participant