Repository navigation
Add SIGMOSFilterStage for audio quality assessment #1577
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
2c80669
Add SIGMOSFilterStage and ensure_cudnn_loaded utility
shubhamNvidia 5faad7a
Add SIGMOS model files
shubhamNvidia e64f75b
Add unit tests for SIGMOSFilterStage
shubhamNvidia f3f8928
Simplified config, removed temp file creation, uses in-memory predict…
shubhamNvidia 01dc37e
Guard GPU fallback, delegate GPU detection to stage, replace print wi…
shubhamNvidia ffd5888
Fix copyrights, restore upstream gpu_utils and added ensure cudnn fun…
shubhamNvidia be96268
Add common utilities, replace duplicate _resolve_model_path in sigmos.py
shubhamNvidia ab83471
change resource allocation pattern
shubhamNvidia dfc6ae9
Remove SIGMOSConfig, modernize types, untrack ADV test
shubhamNvidia 7dacb2e
Merge upstream/main into pr/audio-sigmos
shubhamNvidia b2c48cf
Merge branch 'main' into pr/audio-sigmos
sarahyurick e910433
Fix ruff lint violations in audio sigmos filter stage
shubhamNvidia 9e3c559
Migrate to AudioTask single-dict pattern
shubhamNvidia 3840328
Merge upstream/main, resolve conflicts keeping utility functions
shubhamNvidia 250c67f
Add nested segments handling to SIGMOSFilterStage
shubhamNvidia 6912606
Merge branch 'main' into pr/audio-sigmos
sarahyurick 65730b0
fix ruff linting errors in sigmos files
shubhamNvidia de20c46
Merge upstream/main into pr/audio-sigmos
shubhamNvidia 672dfe0
fix: lazy import predict_audio_mos to avoid onnxruntime import at col…
shubhamNvidia a1f3c82
fix: guard sigmos import to avoid ImportError during test collection
shubhamNvidia 3747312
Merge branch 'main' into pr/audio-sigmos
shubhamNvidia e089988
Merge remote-tracking branch 'upstream/main' into pr/audio-sigmos
shubhamNvidia b3228af
Merge branch 'main' into pr/audio-sigmos
shubhamNvidia 32215b4
Merge upstream/main, resolve conflicts keeping both changes
shubhamNvidia a0022ea
Merge upstream/main and address reviewer feedback for SIGMOS
shubhamNvidia 75809cc
Remove bundled ONNX model, auto-download from Microsoft GitHub
shubhamNvidia d0936c4
Address review feedback: guard teardown, add deps, remove dead code
shubhamNvidia f297f01
Merge branch 'main' into pr/audio-sigmos
sarahyurick b194a3d
Add Microsoft MIT attribution for SIGMOS and Apache 2.0 contribution …
shubhamNvidia 9aa21a3
Merge branch 'main' into pr/audio-sigmos
shubhamNvidia 961e8d0
Adding Microsoft license to LICENSE file
shubhamNvidia 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 |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Copyright (c) 2026, NVIDIA CORPORATION. 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. | ||
|
|
||
| """ | ||
| NeMo Curator Audio Processing Stages. | ||
|
|
||
| Filtering: | ||
| - SIGMOSFilterStage: SIGMOS quality filtering | ||
| """ | ||
|
|
||
| from nemo_curator.stages.audio.filtering import ( | ||
| SIGMOSFilterStage, | ||
| ) | ||
|
|
||
| from nemo_curator.stages.audio.configs import ( | ||
| SIGMOSConfig, | ||
| ) | ||
|
|
||
| __all__ = [ | ||
| "SIGMOSFilterStage", | ||
| "SIGMOSConfig", | ||
| ] |
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,21 @@ | ||
| # Copyright (c) 2026, NVIDIA CORPORATION. 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. | ||
|
|
||
| """Configuration classes for audio processing stages.""" | ||
|
|
||
| from .sigmos import SIGMOSConfig | ||
|
|
||
| __all__ = [ | ||
| "SIGMOSConfig", | ||
| ] |
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,83 @@ | ||
| # Copyright (c) 2026, NVIDIA CORPORATION. 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. | ||
|
|
||
| """SIGMOS (Signal-based Mean Opinion Score) configuration.""" | ||
|
|
||
| from dataclasses import dataclass | ||
| from typing import Any, Optional | ||
|
|
||
| _MODEL_PATH = "model/model-sigmos_1697718653_41d092e8-epo-200.onnx" | ||
|
|
||
|
|
||
| @dataclass | ||
| class SIGMOSConfig: | ||
| """ | ||
| Configuration for SIGMOS quality assessment filter. | ||
|
|
||
| SIGMOS predicts audio quality dimensions (1-5 scale). | ||
| Set threshold to None to disable that check. | ||
|
|
||
| Attributes: | ||
| noise_threshold: Minimum noise score (None to disable) | ||
| ovrl_threshold: Minimum overall score (None to disable) | ||
| sig_threshold: Minimum signal score (None to disable) | ||
| col_threshold: Minimum coloration score (None to disable) | ||
| disc_threshold: Minimum discontinuity score (None to disable) | ||
| loud_threshold: Minimum loudness score (None to disable) | ||
| reverb_threshold: Minimum reverb score (None to disable) | ||
|
|
||
| Example: | ||
| config = SIGMOSConfig(noise_threshold=4.0, ovrl_threshold=3.5) | ||
| """ | ||
|
|
||
| noise_threshold: Optional[float] = 4.0 | ||
| ovrl_threshold: Optional[float] = 3.5 | ||
| sig_threshold: Optional[float] = None | ||
| col_threshold: Optional[float] = None | ||
| disc_threshold: Optional[float] = None | ||
| loud_threshold: Optional[float] = None | ||
| reverb_threshold: Optional[float] = None | ||
|
|
||
| @property | ||
| def model_path(self) -> str: | ||
| return _MODEL_PATH | ||
|
|
||
| @classmethod | ||
| def from_dict(cls, d: Optional[dict] = None) -> "SIGMOSConfig": | ||
| if d is None: | ||
| return cls() | ||
| valid_keys = cls.__dataclass_fields__.keys() | ||
| return cls(**{k: v for k, v in d.items() if k in valid_keys}) | ||
|
|
||
| def to_dict(self) -> dict: | ||
| return { | ||
| 'noise_threshold': self.noise_threshold, | ||
| 'ovrl_threshold': self.ovrl_threshold, | ||
| 'sig_threshold': self.sig_threshold, | ||
| 'col_threshold': self.col_threshold, | ||
| 'disc_threshold': self.disc_threshold, | ||
| 'loud_threshold': self.loud_threshold, | ||
| 'reverb_threshold': self.reverb_threshold, | ||
| } | ||
|
|
||
| def get(self, key: str, default: Any = None) -> Any: | ||
| return getattr(self, key, default) | ||
|
|
||
| def get_active_thresholds(self) -> dict: | ||
| thresholds = {} | ||
| for name in ['noise', 'ovrl', 'sig', 'col', 'disc', 'loud', 'reverb']: | ||
| val = getattr(self, f'{name}_threshold') | ||
| if val is not None: | ||
| thresholds[name] = val | ||
| return thresholds | ||
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,21 @@ | ||
| # Copyright (c) 2026, NVIDIA CORPORATION. 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. | ||
|
|
||
| """Audio quality filtering stages.""" | ||
|
shubhamNvidia marked this conversation as resolved.
Resolved
|
||
|
|
||
| from .sigmos import SIGMOSFilterStage | ||
|
|
||
| __all__ = [ | ||
| "SIGMOSFilterStage", | ||
| ] | ||
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.
Discussed offline. We do not need a config class per stage.