From 09730bad70da816c30e7bd36d5459377c89d343f Mon Sep 17 00:00:00 2001 From: Matt Barnson Date: Mon, 17 Nov 2025 05:12:01 -0800 Subject: [PATCH] MPS support (#5) * MPS support * oops, added issue tracker. * Delete .beads/issues.jsonl --- src/heretic/main.py | 2 ++ src/heretic/utils.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/heretic/main.py b/src/heretic/main.py index f38ea4c..f178469 100644 --- a/src/heretic/main.py +++ b/src/heretic/main.py @@ -88,6 +88,8 @@ def run(): print(f"MUSA type: [bold]{torch.musa.get_device_name()}[/]") elif is_npu_available(): print(f"CANN version: [bold]{torch.version.cann}[/]") + elif torch.backends.mps.is_available(): + print(f"GPU type: [bold]Apple Metal (MPS)[/]") else: print( "[bold yellow]No GPU or other accelerator detected. Operations will be slow.[/]" diff --git a/src/heretic/utils.py b/src/heretic/utils.py index 8e63380..74f0874 100644 --- a/src/heretic/utils.py +++ b/src/heretic/utils.py @@ -58,6 +58,8 @@ def empty_cache(): torch.sdaa.empty_cache() elif is_musa_available(): torch.musa.empty_cache() + elif torch.backends.mps.is_available(): + torch.mps.empty_cache() gc.collect()