mirror of
https://github.com/guillaumemeyer/watermarks-remover.git
synced 2026-08-22 13:11:57 +02:00
fix: never auto-select MPS device for text watermark detection (#99)
This commit is contained in:
parent
c14b5863f9
commit
a65ecb67a6
@@ -71,9 +71,9 @@ def resolve_device(raw: str | None) -> str:
|
||||
|
||||
if torch.cuda.is_available():
|
||||
return "cuda"
|
||||
mps = getattr(torch.backends, "mps", None)
|
||||
if mps is not None and mps.is_available():
|
||||
return "mps"
|
||||
# Never auto-select mps: SynthID/KGW build torch.Generator(device=...),
|
||||
# which supports only cpu/cuda and raises RuntimeError on 'mps' (Apple
|
||||
# Silicon). Fall through to cpu. Pass --device mps explicitly to override.
|
||||
except Exception: # noqa: S110 - optional torch device detection
|
||||
pass
|
||||
return "cpu"
|
||||
|
||||
Reference in New Issue
Block a user