-
Notifications
You must be signed in to change notification settings - Fork 182
Add LibriSpeechMix benchmark with ASR and SA-ASR support #1399
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
Open
vmendelev
wants to merge
3
commits into
main
Choose a base branch
from
vmendelev/issue-65-librispeechmix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| recursive-include nemo_skills *.yaml | ||
| recursive-include nemo_skills *.txt | ||
| recursive-include nemo_skills *.gz | ||
| graft dockerfiles | ||
| graft requirements |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| """LibriSpeechMix benchmark group for overlapped ASR and speaker-attributed ASR.""" | ||
|
|
||
| REQUIRES_DATA_DIR = True | ||
| IS_BENCHMARK_GROUP = True | ||
| SCORE_MODULE = "nemo_skills.dataset.librispeechmix.librispeechmix_score" | ||
|
|
||
| _MODES = ("asr", "sa-asr") | ||
| _SPLITS = ("dev-clean", "test-clean") | ||
| _MIXES = ("1mix", "2mix", "3mix") | ||
|
|
||
| BENCHMARKS = { | ||
| f"librispeechmix.{mode}-{split_name}-{mix_name}": {} | ||
| for mode in _MODES | ||
| for split_name in _SPLITS | ||
| for mix_name in _MIXES | ||
| } |
19 changes: 19 additions & 0 deletions
19
nemo_skills/dataset/librispeechmix/asr-dev-clean-1mix/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| METRICS_TYPE = "audio" | ||
| DEFAULT_SPLIT = "test" | ||
| EVAL_SPLIT = "test" | ||
| EVAL_ARGS = "++eval_type=audio" | ||
| GENERATION_ARGS = "++prompt_format=openai ++enable_audio=true" |
19 changes: 19 additions & 0 deletions
19
nemo_skills/dataset/librispeechmix/asr-dev-clean-2mix/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| METRICS_TYPE = "audio" | ||
| DEFAULT_SPLIT = "test" | ||
| EVAL_SPLIT = "test" | ||
| EVAL_ARGS = "++eval_type=audio" | ||
| GENERATION_ARGS = "++prompt_format=openai ++enable_audio=true" |
19 changes: 19 additions & 0 deletions
19
nemo_skills/dataset/librispeechmix/asr-dev-clean-3mix/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| METRICS_TYPE = "audio" | ||
| DEFAULT_SPLIT = "test" | ||
| EVAL_SPLIT = "test" | ||
| EVAL_ARGS = "++eval_type=audio" | ||
| GENERATION_ARGS = "++prompt_format=openai ++enable_audio=true" |
19 changes: 19 additions & 0 deletions
19
nemo_skills/dataset/librispeechmix/asr-test-clean-1mix/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| METRICS_TYPE = "audio" | ||
| DEFAULT_SPLIT = "test" | ||
| EVAL_SPLIT = "test" | ||
| EVAL_ARGS = "++eval_type=audio" | ||
| GENERATION_ARGS = "++prompt_format=openai ++enable_audio=true" |
19 changes: 19 additions & 0 deletions
19
nemo_skills/dataset/librispeechmix/asr-test-clean-2mix/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| METRICS_TYPE = "audio" | ||
| DEFAULT_SPLIT = "test" | ||
| EVAL_SPLIT = "test" | ||
| EVAL_ARGS = "++eval_type=audio" | ||
| GENERATION_ARGS = "++prompt_format=openai ++enable_audio=true" |
19 changes: 19 additions & 0 deletions
19
nemo_skills/dataset/librispeechmix/asr-test-clean-3mix/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| METRICS_TYPE = "audio" | ||
| DEFAULT_SPLIT = "test" | ||
| EVAL_SPLIT = "test" | ||
| EVAL_ARGS = "++eval_type=audio" | ||
| GENERATION_ARGS = "++prompt_format=openai ++enable_audio=true" |
102 changes: 102 additions & 0 deletions
102
nemo_skills/dataset/librispeechmix/librispeechmix_score.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| # Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
|
|
||
| def _aggregate_bucket(benchmarks: dict, eval_mode: str) -> dict: | ||
| total_entries = 0 | ||
| total_ref_words = 0 | ||
| total_substitutions = 0 | ||
| total_insertions = 0 | ||
| total_deletions = 0 | ||
| weighted_success = 0.0 | ||
| weighted_no_answer = 0.0 | ||
| weighted_tokens = 0.0 | ||
| total_gen_seconds = 0 | ||
|
|
||
| for benchmark_data in benchmarks.values(): | ||
| metrics = benchmark_data.get(eval_mode) | ||
| if not metrics: | ||
| continue | ||
|
|
||
| num_entries = metrics.get("num_entries", 0) | ||
| if num_entries <= 0: | ||
| continue | ||
|
|
||
| total_entries += num_entries | ||
| weighted_success += metrics.get("success_rate", 0.0) * num_entries | ||
| weighted_no_answer += metrics.get("no_answer", 0.0) * num_entries | ||
| weighted_tokens += metrics.get("avg_tokens", 0.0) * num_entries | ||
| total_gen_seconds += metrics.get("gen_seconds", 0) | ||
|
|
||
| total_ref_words += metrics.get("ref_words", 0) | ||
| total_substitutions += metrics.get("substitutions", 0) | ||
| total_insertions += metrics.get("insertions", 0) | ||
| total_deletions += metrics.get("deletions", 0) | ||
|
|
||
| if total_entries == 0: | ||
| return {} | ||
|
|
||
| aggregated = { | ||
| "avg_tokens": int(weighted_tokens / total_entries), | ||
| "gen_seconds": total_gen_seconds, | ||
| "success_rate": weighted_success / total_entries, | ||
| "no_answer": weighted_no_answer / total_entries, | ||
| "num_entries": total_entries, | ||
| } | ||
|
|
||
| if total_ref_words > 0: | ||
| total_errors = total_substitutions + total_insertions + total_deletions | ||
| aggregated["substitutions"] = total_substitutions | ||
| aggregated["insertions"] = total_insertions | ||
| aggregated["deletions"] = total_deletions | ||
| aggregated["ref_words"] = total_ref_words | ||
| aggregated["wer"] = round(100.0 * total_errors / total_ref_words, 2) | ||
|
|
||
| return aggregated | ||
|
|
||
|
|
||
| def compute_score(combined_metrics: dict) -> dict: | ||
| """Aggregate LibriSpeechMix metrics across all sub-benchmarks and by mode.""" | ||
| if not combined_metrics: | ||
| return {} | ||
|
|
||
| first_benchmark = next(iter(combined_metrics.values())) | ||
| eval_modes = list(first_benchmark.keys()) | ||
| grouped = { | ||
| "all": combined_metrics, | ||
| "asr": {name: value for name, value in combined_metrics.items() if ".asr-" in name}, | ||
| "sa-asr": {name: value for name, value in combined_metrics.items() if ".sa-asr-" in name}, | ||
| } | ||
|
|
||
| aggregated = {} | ||
| for eval_mode in eval_modes: | ||
| overall = _aggregate_bucket(grouped["all"], eval_mode) | ||
| if not overall: | ||
| continue | ||
|
|
||
| asr_bucket = _aggregate_bucket(grouped["asr"], eval_mode) | ||
| sa_asr_bucket = _aggregate_bucket(grouped["sa-asr"], eval_mode) | ||
|
|
||
| if asr_bucket.get("wer") is not None: | ||
| overall["asr_wer"] = asr_bucket["wer"] | ||
| if sa_asr_bucket.get("wer") is not None: | ||
| overall["sa_asr_wer"] = sa_asr_bucket["wer"] | ||
| if asr_bucket.get("num_entries") is not None: | ||
| overall["asr_num_entries"] = asr_bucket["num_entries"] | ||
| if sa_asr_bucket.get("num_entries") is not None: | ||
| overall["sa_asr_num_entries"] = sa_asr_bucket["num_entries"] | ||
|
|
||
| aggregated[eval_mode] = overall | ||
|
|
||
| return aggregated |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add explicit LibriSpeechMix evaluation commands and expected tested-model results.
The section documents preparation and scoring assumptions well, but it still needs runnable
ns evalexamples for LibriSpeechMix and expected result snapshots for tested models.📝 Suggested doc patch
As per coding guidelines, "
**/{benchmarks,docs}/**/*.{md,py}: When adding new benchmarks, add it to the corresponding place in the documentation with example commands for running evaluation and expected results for tested models".🤖 Prompt for AI Agents