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

146 bug voice activity detection import fails #208

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

900miles
Copy link
Collaborator

Description

Fixes import errors by not initializing models until a function is called. Also, makes the errors more informative when they do happen.

Related Issue(s)

#146

How Has This Been Tested?

Passes all unit tests, and also some spot checks for the imports described in #146

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have added tests to cover my changes. (N/A, original tests already cover these cases)
  • All new and existing tests passed.
  • My code follows the code style of this project.

@900miles 900miles linked an issue Nov 22, 2024 that may be closed by this pull request
@900miles 900miles self-assigned this Nov 22, 2024
@900miles 900miles added the patch label Nov 22, 2024
@codecov-commenter
Copy link

codecov-commenter commented Nov 22, 2024

Codecov Report

Attention: Patch coverage is 18.36735% with 40 lines in your changes missing coverage. Please review.

Project coverage is 63.79%. Comparing base (113721a) to head (2b12014).
Report is 57 commits behind head on main.

Files with missing lines Patch % Lines
src/senselab/audio/tasks/text_to_speech/marstts.py 0.00% 4 Missing ⚠️
...c/senselab/audio/tasks/text_to_speech/styletts2.py 0.00% 4 Missing ⚠️
...rc/senselab/audio/tasks/speaker_diarization/api.py 25.00% 3 Missing ⚠️
src/senselab/audio/tasks/speaker_embeddings/api.py 25.00% 3 Missing ⚠️
src/senselab/audio/tasks/speech_enhancement/api.py 25.00% 3 Missing ⚠️
src/senselab/audio/tasks/voice_cloning/api.py 25.00% 3 Missing ⚠️
...nselab/audio/tasks/speaker_diarization/pyannote.py 0.00% 2 Missing ⚠️
...elab/audio/tasks/speaker_embeddings/speechbrain.py 0.00% 2 Missing ⚠️
...tasks/speaker_verification/speaker_verification.py 0.00% 2 Missing ⚠️
...senselab/audio/tasks/speech_to_text/huggingface.py 0.00% 2 Missing ⚠️
... and 7 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #208      +/-   ##
==========================================
+ Coverage   60.24%   63.79%   +3.55%     
==========================================
  Files         113      119       +6     
  Lines        4017     4226     +209     
==========================================
+ Hits         2420     2696     +276     
+ Misses       1597     1530      -67     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Copy link
Collaborator

@fabiocat93 fabiocat93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have left some minor comments. Feel free to merge and release the patch once those are addressed and all required checks pass



def diarize_audios(
audios: List[Audio],
model: SenselabModel = PyannoteAudioModel(path_or_uri="pyannote/speaker-diarization-3.1", revision="main"),
model: Optional[PyannoteAudioModel] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use SenselabModel as an input type here, since in the general api we don't want only PyannoteAudioModel objects. I know it's consistent with the current status of implementation, but doesn't communicate properly the intention of the method. And it's same for all other api methods.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, for the static type hints we should use what the function actually supports, not what it would in the future. Because these are explicitly checked by mypy, it seems less confusing to align the type hinting to the actual type check that occurs within the function. And then when we implement other models we can change the type hint. I see your point though and I can make it clearer in the docstring and errors that we would like to support more models in the future.

Comment on lines +32 to +33
if model is None:
model = PyannoteAudioModel(path_or_uri="pyannote/speaker-diarization-3.1", revision="main")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please specify more clearly in the doc string what's the behavior with None? This comment applies for all other cases

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I'll address that

@900miles
Copy link
Collaborator Author

@fabiocat93 I've made some changes to address your comments. Let me know if it's good to merge now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Bug: Voice activity detection import fails
3 participants