Skip to content

Fix Windows GPU diarization for YouDub#264

Open
Zhuyuanbin wants to merge 1 commit into
modelscope:mainfrom
Zhuyuanbin:youdub-windows-gpu
Open

Fix Windows GPU diarization for YouDub#264
Zhuyuanbin wants to merge 1 commit into
modelscope:mainfrom
Zhuyuanbin:youdub-windows-gpu

Conversation

@Zhuyuanbin

Copy link
Copy Markdown

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces several changes to optimize imports and audio loading. It defers the imports of umap and hdbscan to runtime, replaces torchaudio.load with soundfile.read for audio loading, and adds support for a local ModelScope cache directory. Feedback on the changes points out that removing the top-level import of Inference and Model from pyannote.audio will cause a NameError in other parts of the code where they are still used. It is recommended to use a try...except block at the top level to handle these optional imports safely.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.


from pyannote.audio import Inference, Model

parser = argparse.ArgumentParser(description='Speaker diarization inference.')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

Removing the top-level import of Inference and Model will cause a NameError in do_segmentation (line 225) because Inference is used there but is no longer in the global scope. To avoid import errors on systems where pyannote.audio is not installed while keeping the imports available globally, you can use a try...except ImportError block at the top level.

Suggested change
parser = argparse.ArgumentParser(description='Speaker diarization inference.')
try:
from pyannote.audio import Inference, Model
except ImportError:
Inference = None
Model = None
parser = argparse.ArgumentParser(description='Speaker diarization inference.')

Comment on lines +123 to 125
from pyannote.audio import Inference, Model

segmentation_params = {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

With Inference and Model imported at the top level using a try...except block, this local import is no longer necessary and can be removed.

    segmentation_params = {

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.

1 participant