From 6b4d5c86bcfe660cf0a257d3839f7c7a6e235072 Mon Sep 17 00:00:00 2001 From: Jason Wong <86539564+Aintor@users.noreply.github.com> Date: Sun, 2 Jun 2024 19:06:24 +0800 Subject: [PATCH] Apple's MPS backend support (#259) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update webui.py 添加了对于Mac的mps支持,现在可以将device设置为mps来用Mac进行推理 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- tools/webui.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/webui.py b/tools/webui.py index 0571fd7d..c4e33760 100644 --- a/tools/webui.py +++ b/tools/webui.py @@ -131,7 +131,12 @@ def inference( ) with torch.autocast( - device_type=decoder_model.device.type, dtype=args.precision + device_type=( + "cpu" + if decoder_model.device.type == "mps" + else decoder_model.device.type + ), + dtype=args.precision, ): fake_audios = decode_vq_tokens( decoder_model=decoder_model,