Browse Source

Apple's MPS backend support (#259)

* 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>
Jason Wong 1 năm trước cách đây
mục cha
commit
6b4d5c86bc
1 tập tin đã thay đổi với 6 bổ sung1 xóa
  1. 6 1
      tools/webui.py

+ 6 - 1
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,