Fix critical device handling issues that cause cache mismatches and unnecessary reloads:
1. Cache 'auto' device resolution (torch_device_resolver.py)
- 'auto' device now cached after first resolution
- Prevents cache key instability when device availability changes mid-session
- Add reset_device_cache() for manual reset if needed
- Fixes: GPU memory pressure causing unexpected CPU fallback
2. Fix device comparison in unified interface (unified_model_interface.py)
- Resolve both target and wrapper device before comparison
- Handle both string and torch.device object representations
- Fixes: Device type mismatch causing models to stay on wrong device
3. Consolidate device resolution (base_node.py)
- Replace duplicate resolve_device() with centralized torch_device_resolver
- Now supports MPS (Apple Silicon), CUDA, XPU, and CPU consistently
- Fixes: Missing MPS/XPU detection in base node
Impact:
- Eliminates unnecessary model reloads in long sessions
- Consistent device handling across all node types
- Better GPU memory management with stable cache keys
Add Intel XPU support (tentative)
Implementation details:
- Add XPU detection to torch_device_resolver with proper fallback chain
- Update all engine nodes to include xpu device option
- Add defensive hasattr checks for systems without XPU installed
- Requires separate intel-extension-for-pytorch installation
- Created utils/device/torch_device_resolver.py with intelligent device detection
- Supports MPS (Metal Performance Shaders) for Apple Silicon
- Fallback chain: MPS > CUDA > CPU for auto-detection
- Safe detection with torch.backends.mps.is_available() checks
- Updated all 7 engine nodes to expose 'mps' device option:
- ChatterBox, F5-TTS, Higgs Audio, VibeVoice
- ChatterBox Official 23-Lang, Index TTS, RVC
- Integrated device resolver across all engine implementations:
- unified_model_interface.py (central point)
- comfyui_model_wrapper/base_wrapper.py (ComfyUI integration)
- All direct engine implementations (VibeVoice, Higgs Audio, F5-TTS edit, etc.)
- Maintains backward compatibility:
- Existing workflows unchanged
- MPS added as final option in device dropdowns
- No behavior changes for Linux/Windows users
Resolves#160 - Users on Apple Silicon can now select MPS for GPU acceleration