Skip to content

Conversation

@Dw9
Copy link

@Dw9 Dw9 commented Jul 25, 2025

按照官网的步骤安装 测试环境 ubuntu 22.04 GPU 4*4090 运行demo 报错; python demo.py
Running MossFormer2_SE_48K ...
0%| | 0/1 [00:00<?,
?it/s]
Traceback (most recent call last):
File "demo.py", line 25, in
output_wav = myClearVoice_SE(input_path='samples/input.wav', online_write=False)
File "/home/user/dw/ClearerVoice-Studio/clearvoice/clearvoice/init.py", line 46, in call
return self.call_io_mode(input_path=input_path, online_write=online_write, output_path=output_path)
File "/home/user/dw/ClearerVoice-Studio/clearvoice/clearvoice/init.py", line 62, in call_io_mode
result = model.process(input_path, online_write, output_path)
File "/home/user/dw/ClearerVoice-Studio/clearvoice/clearvoice/networks.py", line 290, in process
output_audios = self.decode()
File "/home/user/dw/ClearerVoice-Studio/clearvoice/clearvoice/networks.py", line 199, in decode
output_audio = decode_one_audio(self.model, self.device, self.data['audio'][i], self.args)
File "/home/user/dw/ClearerVoice-Studio/clearvoice/clearvoice/utils/decode.py", line 41, in decode_one_audio
return decode_one_audio_mossformer2_se_48k(model, device, inputs, args)
File "/home/user/dw/ClearerVoice-Studio/clearvoice/clearvoice/utils/decode.py", line 429, in decode_one_audio_mossformer2_se_48k
Out_List = model(fbanks)
File "/home/user/miniconda3/envs/ClearerVoice-Studio/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/user/miniconda3/envs/ClearerVoice-Studio/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/home/user/dw/ClearerVoice-Studio/clearvoice/clearvoice/models/mossformer2_se/mossformer2_se_wrapper.py", line 95, in forward
mask = self.mossformer(x) # Forward pass through the MossFormer_MaskNet
File "/home/user/miniconda3/envs/ClearerVoice-Studio/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/user/miniconda3/envs/ClearerVoice-Studio/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/home/user/dw/ClearerVoice-Studio/clearvoice/clearvoice/models/mossformer2_se/mossformer2.py", line 608, in forward
x = self.norm(x)
File "/home/user/miniconda3/envs/ClearerVoice-Studio/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/user/miniconda3/envs/ClearerVoice-Studio/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/home/user/miniconda3/envs/ClearerVoice-Studio/lib/python3.8/site-packages/torch/nn/modules/normalization.py", line 288, in forward
return F.group_norm(
File "/home/user/miniconda3/envs/ClearerVoice-Studio/lib/python3.8/site-packages/torch/nn/functional.py", line 2606, in group_norm
return torch.group_norm(input, num_groups, weight, bias, eps, torch.backends.cudnn.enabled)
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:1 and cuda:0! (when checking argument for argument weight in method wrapper_CUDA__native_group_norm)

Copy link

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

Choose a reason for hiding this comment

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

Summary of Changes

Hello @Dw9, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a RuntimeError that occurred in multi-GPU environments due to tensors being on different CUDA devices. The change ensures that the PyTorch device context is consistently set to the specific GPU selected for operations, preventing device mismatch issues and allowing the application to run correctly on systems with multiple GPUs.

Highlights

  • GPU Device Assignment Fix: Corrected the device initialization logic to explicitly assign the PyTorch device (self.device) to the specific cuda:X ID that was identified as free and set via torch.cuda.set_device. Previously, it would default to cuda:0 even if a different GPU was selected, leading to device mismatch errors.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

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

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 fixes a RuntimeError that occurs in multi-GPU environments by making the PyTorch device selection explicit. The change ensures tensors are allocated on the correct GPU by specifying the device ID, which resolves the crash described in the pull request. The fix is correct and well-implemented.

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