[Feature]: Allow specifying CUDA device in configure_cuda

未关闭
#225 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

  • #306 来自 @be-student —— 已关闭,未合并

评估

难度
3/5
预计耗时
1-2 天
新手友好度
48/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
python, pytorch

调研方向

首先定位 configure_cuda 及其调用方,包括 setup_torch_device,并检查 torch 设备和 ONNX Runtime providers 的配置方式。添加可选的设备选择,同时保留默认行为,然后验证 PyTorch 和 ONNX Runtime 都使用所选的 GPU。

由索引模型根据 Issue 内容生成。

描述

enhancement
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~

主要语言
Python
星标
1.5k
派生
216
平均合并
1 小时
30 天内合并 PR
2

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nomadkaraoke/python-audio-separator 的其他 Issue

查看 nomadkaraoke/python-audio-separator 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。