Skip to content

Honor the configured ONNX device preference - #4

Open
jmoujaled wants to merge 1 commit into
niranjanakella:mainfrom
jmoujaled:fix/honor-device-preference
Open

Honor the configured ONNX device preference#4
jmoujaled wants to merge 1 commit into
niranjanakella:mainfrom
jmoujaled:fix/honor-device-preference

Conversation

@jmoujaled

Copy link
Copy Markdown

Summary

AppConfig.device exists (defaulting to "cpu") but was never actually used —
ONNXTTSEngine._get_available_providers() ignored it and always auto-selected
CoreML > CUDA > CPU. So setting device in the config had no effect (e.g. a
user asking for cpu still got CoreML on Apple Silicon). This makes the engine
honor the setting.

Behavior

device Providers used
cpu CPUExecutionProvider only
cuda CUDAExecutionProvider (if available) → CPU fallback
coreml / mps CoreMLExecutionProvider (if available) → CPU fallback
auto (or unknown) previous priority order: CoreML → CUDA → CPU
  • CPU is always appended as a safety fallback.
  • When a requested accelerator isn't available, it logs a warning and falls back
    to CPU instead of failing.
  • auto preserves the existing behavior exactly, so nothing changes for anyone
    who hasn't set device.

Notes

  • Single-file change, no new dependencies.
  • The device field comment is updated to document the accepted values.
  • Verified provider selection for all five modes.

AppConfig.device was defined (default 'cpu') but _get_available_providers
ignored it entirely and always auto-selected CoreML > CUDA > CPU, so the
setting was dead config. Respect it: 'cpu' forces CPU, 'cuda'/'coreml'/'mps'
prefer that provider with a CPU fallback, and 'auto' keeps the previous
priority behavior. CPU is always appended as a safety net.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant