nomadkaraoke / nomadkaraoke/python-audio-separator

[Feature]: Allow specifying CUDA device in configure_cuda

Open
#225 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
1.4k
Forks
199
Avg merge
4h 17m
Merged PRs (30d)
4

Description

Description

Hi,

I’m currently using the setup_torch_device and configure_cuda methods. Right now, configure_cuda always sets:

self.torch_device = torch.device("cuda")

which defaults to the first available GPU (cuda:0). On multi-GPU systems, the first GPU might already be in use, and it would be useful to allow selecting a specific GPU.

Proposed:
Add an optional argument to configure_cuda, e.g., device_index, so that the device can be explicitly set:

def configure_cuda(self, ort_providers, device_index=0):
    self.torch_device = torch.device(f"cuda:{device_index}")

This would allow both PyTorch and ONNX Runtime to use the specified GPU, instead of always defaulting to cuda:0.

Thank you~

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating configure_cuda and its callers, including setup_torch_device, and inspect how the torch device and ONNX Runtime providers are configured. Add optional device selection while preserving the default behavior, then verify that both PyTorch and ONNX Runtime use the selected GPU.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.