diodiogod
|
a8c62f2307
|
TIER 3: Complete architecture standardization for model loading
Implement standardized factory infrastructure enabling future engines:
1. ModelLoadConfig dataclass - Single canonical config class for all factories
- Replaces duplicate UnifiedModelConfig
- Contains device, model_name, language, model_path, repo_id, additional_params
- Device resolution in __post_init__ for consistency
2. Engine capability registry - Data-driven engine specifications
- Defines supports_voice_conversion, multilingual_model_switching, corruption recovery
- Enables generic error handling without hardcoded engine checks
- Covers all 7 TTS engines + IndexTTS-2
3. Fallback handler utility - Reusable fallback chain for graceful degradation
- Try local → download → fallback language pattern
- Eliminates duplicate fallback code across engines
- Used by future engines automatically
4. Exception hierarchy - Standardized error types
- TTSModelLoadingError base class
- Specific types: NotFoundError, DeviceError, FormatError, InitializationError, LanguageNotSupportedError
Architecture benefits:
- All 8 factories now accept config: ModelLoadConfig instead of **kwargs
- Type-safe, clear factory signatures
- Future engines follow identical pattern
- No deprecated code left behind
- ComfyUI model manager handles both old and new patterns
Testing:
- All 7 TTS engines working correctly
- Device switching and caching working
- No syntax errors, all files compile
Note: SmartModelLoader still in use (Tier 2 cleanup pending) causing benign double-loads on some engines.
|
2025-11-14 10:10:52 -03:00 |
|