初步支持 macOS (Apple Silicon)

升级至PP-OCRv5
Tested with Python 3.13
感谢用户 "期望" 提供的macOS设备用于开发测试
This commit is contained in:
Jason
2025-05-18 19:21:33 +08:00
parent c673b5ccd1
commit 7cf4e882cd
20 changed files with 56 additions and 62 deletions

View File

@@ -395,7 +395,7 @@ class SubtitleRemover:
accelerator_name = self.hardware_accelerator.accelerator_name
if accelerator_name == 'DirectML' and config.inpaintMode.value in [InpaintMode.STTN_AUTO, InpaintMode.STTN_DET]:
model_device = 'DirectML'
if self.hardware_accelerator.has_cuda():
if self.hardware_accelerator.has_cuda() or self.hardware_accelerator.has_mps():
model_device = accelerator_name
self.append_output(tr['Main']['UseModel'].format(f"{model_friendly_name} ({model_device})"))
@@ -446,7 +446,7 @@ class SubtitleRemover:
@cached_property
def lama_inpaint(self):
model_path = os.path.join(self.model_config.LAMA_MODEL_DIR, 'big-lama.pt')
device = self.hardware_accelerator.device if self.hardware_accelerator.has_cuda() else torch.device("cpu")
device = self.hardware_accelerator.device if self.hardware_accelerator.has_cuda() or self.hardware_accelerator.has_mps() else torch.device("cpu")
return LamaInpaint(device, model_path)
@cached_property