fix(common): collect whole labels in FeatureLabel.uniq_labels - #16326
Open
MohammadHijjawi97 wants to merge 1 commit into
Open
MohammadHijjawi97 wants to merge 1 commit into
MohammadHijjawi97 wants to merge 1 commit into
Conversation
FeatureLabel accumulated `set(label)` for each manifest entry, so a classification manifest labelled "speech"/"background" produced a vocabulary of single characters, and the result was a bare set. The labels=None fallback of FeatureToLabelDataset then failed with "TypeError: 'set' object is not subscriptable", and regression manifests (float labels) failed in ASRFeatureLabel with "TypeError: 'float' object is not iterable". Collect whole labels and expose them as a sorted list, matching SpeechLabel.uniq_labels. Fixes NVIDIA-NeMo#16106 Signed-off-by: Mohammad Hijjawi <mohammad.hijjawi1997@gmail.com>
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Important
The
Update branchbutton must only be pressed in very rare occassions.An outdated branch is never blocking the merge of a PR.
Please reach out to the automation team before pressing that button.
What does this PR do ?
Make
FeatureLabel.uniq_labelsthe sorted list of distinct labels instead of a set of the labels' characters, soFeatureToLabelDataset(labels=None)and regression manifests work.Collection: common (used by ASR
FeatureToLabelDataset)Changelog
FeatureLabelnow adds each whole label to its unique-label set, and exposesuniq_labelsas a sorted list, matchingSpeechLabel.uniq_labels. Before,set(label)gave single characters (speech/backgroundbecame 14 letters). That broke thelabels=Nonefallback ofFeatureToLabelDatasetwithTypeError: 'set' object is not subscriptable, and float labels in regression manifests failed withTypeError: 'float' object is not iterable.tests/collections/asr/test_label_datasets.py.Usage
GitHub Actions CI
The Jenkins CI system has been replaced by GitHub Actions self-hosted runners.
Trusted PRs run automatically through copy-pr-bot. For an untrusted PR, a maintainer can trigger CI by commenting
/ok to test <head-sha>; repeat this after a new push if the PR remains untrusted.Before your PR is "Ready for review"
Pre checks:
PR Type:
If you haven't finished some of the above items you can still open "Draft" PR.
Who can review?
Anyone in the community is free to review the PR once the checks have passed.
Contributor guidelines contains specific people who can review PRs to various areas.
Additional Information
pytest --noconftest tests/collections/asr/test_label_datasets.py -k feat_label. The 2 new tests fail onmainand pass with the fix, and the existingtest_feat_label_datasetstill passes.pre-commit runis clean. The other tests in that file need the downloaded test-data archive, so I did not run them locally.None, automatically picks from the collection" behaviour.