@@ -278,9 +278,9 @@ def setup_backend_device(backend='auto', device='auto'):
278278 logging .warning (f"Device '{ device } ' not recognized. Falling back to auto-detection." )
279279 device = 'auto'
280280
281- if device != 'auto' and backend = = 'auto' :
281+ if backend == 'auto' and device ! = 'auto' :
282282 logging .warning (f"Backend is set to 'auto' but device is not. Both will be determined automatically." )
283- elif device == 'auto' and backend ! = 'auto' :
283+ elif backend != 'auto' and device = = 'auto' :
284284 logging .warning (f"Device is set to 'auto' but backend is not. Both will be determined automatically." )
285285
286286 if backend != 'auto' and device != 'auto' :
@@ -311,10 +311,11 @@ def setup_backend_device(backend='auto', device='auto'):
311311 return 'onnxruntime' , 'rocm'
312312
313313 # # Issues currently with mps inference (see https://github.com/Tau-J/rtmlib/issues/77)
314- # # onnxruntime, mps
315- # if 'MPSExecutionProvider' in available_providers or 'CoreMLExecutionProvider' in available_providers:
316- # logging.info("Valid MPS installation found: using ONNXRuntime backend with GPU.")
317- # return 'onnxruntime', 'mps'
314+ # onnxruntime, mps
315+ if 'MPSExecutionProvider' in available_providers or 'CoreMLExecutionProvider' in available_providers :
316+ logging .info ("Valid MPS installation found: using ONNXRuntime backend with GPU." )
317+ # return 'onnxruntime', 'mps'
318+ return 'onnxruntime' , 'cpu'
318319
319320 # openvino, cpu
320321 logging .info ("No valid CUDA, ROCM, or MPS installation found: using OpenVINO backend with CPU." )
0 commit comments