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

Mac M2 Max 源码运行如何调用gpu #1802

Closed
Oceannew opened this issue Jun 11, 2024 · 5 comments
Closed

Mac M2 Max 源码运行如何调用gpu #1802

Oceannew opened this issue Jun 11, 2024 · 5 comments
Labels
question Further information is requested

Comments

@Oceannew
Copy link

Oceannew commented Jun 11, 2024

我修改了funasr_wss_server.py文件的配置,把cpu改为mps并没有效果。

我在google上没有找到解决方法。

修改的代码:

parser.add_argument("--ngpu", type=int, default=1, help="0 for cpu, 1 for gpu")
parser.add_argument("--device", type=str, default="mps", help="cuda, cpu")
parser.add_argument("--ncpu", type=int, default=10, help="cpu cores")

environment:

  • OS (e.g., Linux):MAC
  • FunASR Version (e.g., 1.0.0):1.0.18
  • ModelScope Version (e.g., 1.11.0):1.14.0
  • PyTorch Version (e.g., 2.0.0):2.3.0
  • How you installed funasr (pip, source):source
  • Python version:3.8.0
  • GPU (e.g., V100M32):M2
  • CUDA/cuDNN version (e.g., cuda11.7):none
  • Docker version (e.g., funasr-runtime-sdk-cpu-0.4.1)
  • Any other relevant information:
@Oceannew Oceannew added the question Further information is requested label Jun 11, 2024
@LauraGPT
Copy link
Collaborator

We don't know M2, you could ref to torch. funasr is torch-based.

@XUJiahua
Copy link

可以看下这段代码:

device = "cpu"

指定了 mps,也会被回退到 cpu。

除了 spk_model 不兼容,其他模型都能在 mps 下跑。

@AlienKevin
Copy link

I can confirm that SenseVoiceSmall is runnable on mps, after commenting out the lines that coerse the device to CPU.
@LauraGPT Could you please remove the device coersion lines? I was extremely confused at first because I specified the device as MPS but saw no GPU usage on my Mac. If you are worried about device compatability for certain model-device pairs, maybe a warning message is more appropriate/helpful.

@LauraGPT
Copy link
Collaborator

LauraGPT commented Aug 1, 2024

I can confirm that SenseVoiceSmall is runnable on mps, after commenting out the lines that coerse the device to CPU. @LauraGPT Could you please remove the device coersion lines? I was extremely confused at first because I specified the device as MPS but saw no GPU usage on my Mac. If you are worried about device compatability for certain model-device pairs, maybe a warning message is more appropriate/helpful.

Fine. Do you know how to detect running on mps?

@AlienKevin
Copy link

@LauraGPT You can use torch.backends.mps.is_available() to detect if the MPS backend is supported. And the device name for MPS is simply the string mps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants