Users are reporting two distinct errors:
- Missing espeak-ng-data/phontab file:
Error processing file '/home/runner/work/espeakng-loader/espeakng-loader/espeak-ng/_dynamic/share/espeak-ng-data/phontab': No such file or directory.
- Invalid pipeline state:
Error generating speech: The object is in an invalid state.
The dependency chain has changed:
Before:
kokoro-fastapi (phonemizer 3.3.0) -> kokoro -> misaki -> phonemizer
After:
kokoro-fastapi -> kokoro -> misaki -> phonemizer-fork + espeakng-loader
The issue arises because:
- misaki now uses espeakng-loader to manage espeak paths
- espeakng-loader looks for data in its package directory
- We have a direct dependency on phonemizer 3.3.0 that conflicts
The "invalid state" error occurs due to device mismatch in pipeline creation.
Update dependencies and environment:
- Remove direct phonemizer dependency:
- "phonemizer==3.3.0", # Remove this
-
Let misaki handle phonemizer-fork and espeakng-loader
-
Set environment variable in Dockerfile:
ENV PHONEMIZER_ESPEAK_PATH=/usr/bin \
PHONEMIZER_ESPEAK_DATA=/usr/share/espeak-ng-data \
ESPEAK_DATA_PATH=/usr/share/espeak-ng-data # Add this
This approach:
- Works with misaki's new dependencies
- Maintains our working espeak setup
- Avoids complex file copying or path manipulation
Use kokoro_v1's pipeline management:
# Instead of creating pipelines directly:
# pipeline = KPipeline(...)
# Use backend's pipeline management:
pipeline = backend._get_pipeline(pipeline_lang_code)
-
Update pyproject.toml:
- Remove direct phonemizer dependency
- Keep misaki dependency as is
-
Update Dockerfiles:
- Add ESPEAK_DATA_PATH environment variable
- Keep existing espeak-ng setup
-
Update tts_service.py:
- Use backend's pipeline management
- Add proper error handling
-
Test espeak-ng functionality:
# Verify environment variables echo $ESPEAK_DATA_PATH echo $PHONEMIZER_ESPEAK_DATA # Check data directory ls /usr/share/espeak-ng-data
-
Test pipeline state:
- Test on both CPU and GPU
- Verify no invalid state errors
- Test with different voice models
- No espeak-ng-data/phontab file errors
- No invalid state errors
- Consistent behavior across platforms
- Successful CI/CD pipeline runs
-
Potential PR to misaki:
- Add fallback mechanism if espeakng-loader fails
- Make path configuration more flexible
- Add better error messages
-
Environment Variable Documentation:
- Document ESPEAK_DATA_PATH requirement
- Explain interaction with espeakng-loader
- Provide platform-specific setup instructions
- This solution works with misaki's new dependencies while maintaining our setup
- Environment variable approach is simpler than file copying
- May want to contribute improvements back to misaki later