| # text-to-speech-maya |
|
|
| A small playground for the Maya text-to-speech inference handler and a FastAPI test server. |
|
|
| ## Run the FastAPI test server (local) |
|
|
| 1. Install dependencies. Follow the official PyTorch instructions for your platform first (CPU/MPS/CUDA), then install the remaining requirements: |
|
|
| ```bash |
| # Example: install torch from https://pytorch.org/ for your system first, then: |
| pip install -r inference_endpoints/requirements.txt |
| ``` |
|
|
| 2. Start the server (set `MAYA_MODEL_PATH` to your model path if needed): |
|
|
| ```bash |
| export MAYA_MODEL_PATH="/path/to/maya_model" |
| uvicorn server.app:app --reload --host 0.0.0.0 --port 8000 |
| ``` |
|
|
| 3. Test the synthesis endpoint (saves `output.wav`): |
|
|
| ```bash |
| curl -X POST "http://localhost:8000/synthesize" -H "Content-Type: application/json" -d '{ |
| "description": "neutral female voice", |
| "text": "Hello world from Maya TTS" |
| }' --output output.wav |
| ``` |
|
|
| Notes |
|
|
| - The `EndpointHandler` expects the Maya model to be compatible with the SNAC decoder flow; you may need to adapt token decoding depending on the actual model outputs. |
| - `torch` often requires platform-specific wheels; if `pip install -r` fails for `torch`, install the appropriate wheel from pytorch.org first then re-run the requirements install for the remaining packages. |
|
|
| --- |
|
|
| ## VSCode setup (recommended) |
|
|
| The repo includes helper files to make development in VSCode convenient: a workspace `.venv`, editor settings, tasks, and launch configurations. |
|
|
| 1. Create and activate a workspace venv (the Makefile has a helper): |
|
|
| ```bash |
| make venv |
| source .venv/bin/activate |
| ``` |
|
|
| 2. Install project requirements into the venv: |
|
|
| ```bash |
| pip install -r inference_endpoints/requirements.txt |
| # dev tools for formatting & linting |
| pip install black flake8 |
| ``` |
|
|
| 3. Open this folder in VSCode. The workspace settings point to `${workspaceFolder}/.venv/bin/python` and the Python extension will activate the venv in the terminal. |
|
|
| 4. Useful VSCode features included: |
|
|
| - Formatting: `Black` is configured and will run on save (line length 88). |
| - Linting: `flake8` is enabled; run it using the Tasks panel or via the command palette. |
| - Tasks: Run `Format: black`, `Lint: flake8`, or `Run server (run.sh)` from the Tasks menu. |
| - Launch: Use the `Run FastAPI (uvicorn)` launch configuration to start the server with debugging enabled. It will load `server/.env` for environment variables. |
|
|
| 5. Running the server from VSCode: |
|
|
| - Use the Run panel and choose `Run FastAPI (uvicorn)` to start with the debugger. |
| - Or open the integrated terminal, ensure the venv is active, and run: |
|
|
| ```bash |
| ./run.sh |
| ``` |
|
|
| 6. Poetry users |
|
|
| If you prefer Poetry for the server package, there's a `server/pyproject.toml`. From `server/` run: |
|
|
| ```bash |
| poetry install |
| poetry run uvicorn server.app:app --reload --host 0.0.0.0 --port 8000 |
| ``` |
|
|
| --- |
|
|
| If you want I can add a short checklist or developer guide in `DEVELOPING.md` with these steps and troubleshooting tips. |
|
|
| # text-to-speech-maya |
|
|
| A small playground for the Maya text-to-speech inference handler and a FastAPI test server. |
|
|
| ## Run the FastAPI test server (local) |
|
|
| 1. Install dependencies. Follow the official PyTorch instructions for your platform first (CPU/MPS/CUDA), then install the remaining requirements: |
|
|
| ```bash |
| # Example: install torch from https://pytorch.org/ for your system first, then: |
| pip install -r inference_endpoints/requirements.txt |
| ``` |
|
|
| 2. Start the server (set `MAYA_MODEL_PATH` to your model path if needed): |
|
|
| ```bash |
| export MAYA_MODEL_PATH="/path/to/maya_model" |
| uvicorn server.app:app --reload --host 0.0.0.0 --port 8000 |
| ``` |
|
|
| 3. Test the synthesis endpoint (saves `output.wav`): |
|
|
| ```bash |
| curl -X POST "http://localhost:8000/synthesize" -H "Content-Type: application/json" -d '{ |
| "description": "neutral female voice", |
| "text": "Hello world from Maya TTS" |
| }' --output output.wav |
| ``` |
|
|
| Notes |
|
|
| - The `EndpointHandler` expects the Maya model to be compatible with the SNAC decoder flow; you may need to adapt token decoding depending on the actual model outputs. |
| - `torch` often requires platform-specific wheels; if `pip install -r` fails for `torch`, install the appropriate wheel from pytorch.org first then re-run the requirements install for the remaining packages. |
|
|