MioTTS-Inference

February 14, 2026 · View on GitHub

Hugging Face Collection Demo License: MIT

日本語版 README はこちら

Overview

Inference code for MioTTS, a lightweight and fast TTS model.

Key features:

  • Compatible with common LLM inference frameworks (llama.cpp, Ollama, vLLM, etc.)
  • Speech synthesis via REST API
  • Reference audio preset registration
  • Best-of-N for high-quality audio selection

Models

Model NameParametersLicense
MioTTS-0.1B0.1BFalcon-LLM License
MioTTS-0.4B0.4BLFM Open License v1.0
MioTTS-0.6B0.6BApache 2.0
MioTTS-1.2B1.2BLFM Open License v1.0
MioTTS-1.7B1.7BApache 2.0
MioTTS-2.6B2.6BLFM Open License v1.0

Quantized models:

ModelPurpose
MioTTS-GGUFQuantized models for llama.cpp / Ollama

Setup

git clone https://github.com/Aratako/MioTTS-Inference.git
cd MioTTS-Inference
uv sync
# Install flash-attention (recommended)
# Adjust MAX_JOBS based on your CPU specs
MAX_JOBS=8 uv pip install --no-build-isolation -v flash-attn

Usage

1. Starting the TTS Model Inference Server

Start the inference server for the TTS model. Since the model architecture is identical to standard LLMs, you can use common LLM inference frameworks. Make sure to set up an OpenAI Compatible API.

llama.cpp

Follow the official Quick Start to install llama.cpp, then start the inference server as follows. Adjust the -hff parameter according to the model you want to use.

llama-server -hf Aratako/MioTTS-GGUF -hff MioTTS-1.2B-BF16.gguf -c 8192 --cont-batching --batch_size 8 --port 8000

Ollama

Follow the official Download to install Ollama, then start the inference server as follows. Adjust the model name according to your preference.

# Using CLI
OLLAMA_HOST=localhost:8000 ollama serve
# In a separate window
OLLAMA_HOST=localhost:8000 ollama run hf.co/Aratako/MioTTS-GGUF:MioTTS-1.2B-BF16.gguf

vLLM

Follow the official Installation to install vLLM, then start the inference server as follows. Adjust the model name according to your preference. Also adjust --gpu-memory-utilization based on your GPU specs.

vllm serve Aratako/MioTTS-1.2B --max-model-len 1024 --gpu-memory-utilization 0.2

Other inference frameworks such as LMStudio or SGLang will also work as long as they can provide an OpenAI Compatible API.

2. Starting the Speech Synthesis API

Start the speech synthesis API server provided in this repository. Make sure the port matches the server started in step 1 (for example, Ollama uses port 11434 by default).

python run_server.py --llm-base-url http://localhost:8000/v1

Add --best-of-n-enabled to enable Best-of-N speech synthesis. This setting generates N candidates simultaneously for a single input text and returns the best audio based on heuristic evaluation such as ASR (Whisper) error rate.

python run_server.py --llm-base-url http://localhost:8000/v1 --best-of-n-enabled

3. Starting the WebUI

A simple WebUI demo is available that uses the speech synthesis API started in the steps above.

python run_gradio.py

After running, access the WebUI at http://localhost:7860.

Environment Variables / CLI Arguments

run_server.py (Speech Synthesis API Server)

Settings can be changed via environment variables or CLI arguments. CLI arguments take precedence.

Server Settings

ArgumentEnvironment VariableDefaultDescription
--hostMIOTTS_HOST0.0.0.0Server host
--portMIOTTS_PORT8001Server port
--reloadMIOTTS_RELOADfalseEnable hot reload
--log-levelMIOTTS_LOG_LEVELinfoLog level

LLM Settings

ArgumentEnvironment VariableDefaultDescription
--llm-base-urlMIOTTS_LLM_BASE_URLhttp://localhost:8000/v1LLM API base URL
--llm-api-keyMIOTTS_LLM_API_KEYNoneLLM API key (if required)
--llm-modelMIOTTS_LLM_MODELAuto-detectedLLM model name
--llm-timeoutMIOTTS_LLM_TIMEOUT120.0LLM request timeout (seconds)

Sampling Parameters

Environment VariableDefaultDescription
MIOTTS_LLM_TEMPERATURE0.8Temperature
MIOTTS_LLM_TOP_P1.0Top-P
MIOTTS_LLM_MAX_TOKENS700Maximum generation tokens
MIOTTS_LLM_REPETITION_PENALTY1.0Repetition Penalty (1.0-1.5)
MIOTTS_LLM_PRESENCE_PENALTY0.0Presence Penalty (0.0-1.0)
MIOTTS_LLM_FREQUENCY_PENALTY0.0Frequency Penalty (0.0-1.0)

Codec Settings

ArgumentEnvironment VariableDefaultDescription
--codec-modelMIOTTS_CODEC_MODELAratako/MioCodec-25Hz-44.1kHz-v2MioCodec model name
--deviceMIOTTS_DEVICEcuda (or cpu if unavailable)Codec inference device

Preset Settings

ArgumentEnvironment VariableDefaultDescription
--presets-dirMIOTTS_PRESETS_DIRpresetsPresets directory

Best-of-N Settings

ArgumentEnvironment VariableDefaultDescription
--best-of-n-enabledMIOTTS_BEST_OF_N_ENABLEDfalseEnable Best-of-N
--best-of-n-defaultMIOTTS_BEST_OF_N_DEFAULT1Default N (1 = normal generation)
--best-of-n-maxMIOTTS_BEST_OF_N_MAX8Maximum value of N
--best-of-n-languageMIOTTS_BEST_OF_N_LANGUAGEautoLanguage setting for Best-of-N (auto/ja/en)

ASR Settings (for Best-of-N)

ArgumentEnvironment VariableDefaultDescription
--asr-modelMIOTTS_ASR_MODELopenai/whisper-large-v3-turboASR model
--asr-deviceMIOTTS_ASR_DEVICESame as MIOTTS_DEVICEASR inference device
--asr-compute-typeMIOTTS_ASR_COMPUTE_TYPEfloat16 (cuda) / int8 (cpu)ASR compute precision
--asr-batch-sizeMIOTTS_ASR_BATCH_SIZE0 (all parallel)ASR batch size
--asr-languageMIOTTS_ASR_LANGUAGEautoASR language

Other Settings

ArgumentEnvironment VariableDefaultDescription
--max-text-lengthMIOTTS_MAX_TEXT_LENGTH300Maximum input text length
--max-reference-mbMIOTTS_MAX_REFERENCE_MB20Maximum reference audio size (MB)
--allowed-audio-extsMIOTTS_ALLOWED_AUDIO_EXTS.wav,.flac,.oggAllowed audio extensions

The maximum reference audio length is fixed at 20 seconds.

run_gradio.py (WebUI)

Environment VariableDefaultDescription
MIOTTS_API_BASEhttp://localhost:8001Speech synthesis API server base URL

You can also change the API Base URL from "Advanced Settings" in the WebUI.

Reference Audio Presets

Instead of providing reference audio each time, you can pre-encode audio with the codec and register it as a reusable preset.

python scripts/generate_preset.py --audio /path/to/audio.wav --preset-id preset_name

generate_preset.py Arguments

ArgumentRequiredDefaultDescription
--audioYes-Path to reference audio file
--preset-idYes-Preset ID (becomes the filename)
--output-dirNopresetsOutput directory
--model-idNoAratako/MioCodec-25Hz-44.1kHz-v2MioCodec model name
--deviceNocudaInference device

Default Presets

The following presets are included:

  • jp_female - Japanese female voice
  • jp_male - Japanese male voice
  • en_female - English female voice
  • en_male - English male voice

API Specification

Health Check

GET /health

Response:

{"status": "ok"}

List Presets

GET /v1/presets

Response:

{"presets": ["en_female", "en_male", "jp_female", "jp_male"]}

Speech Synthesis (JSON Request)

POST /v1/tts
Content-Type: application/json

Request Body:

{
  "text": "Text to synthesize",
  "reference": {
    "type": "preset",
    "preset_id": "jp_female"
  },
  "llm": {
    "temperature": 0.8,
    "top_p": 1.0,
    "max_tokens": 700,
    "repetition_penalty": 1.0,
    "presence_penalty": 0.0,
    "frequency_penalty": 0.0
  },
  "output": {
    "format": "base64"
  },
  "best_of_n": {
    "enabled": false,
    "n": 1,
    "language": "auto"
  }
}

reference is required. Text preprocessing applies normalization for Japanese input, and only strip() for other languages.

FieldTypeRequiredDescription
textstringYesText to synthesize
reference.typestringYespreset or base64
reference.preset_idstringConditionalRequired when type=preset
reference.datastringConditionalRequired when type=base64
llm.*-NoLLM parameters
output.formatstringNowav or base64 (default: base64)
best_of_n.*-NoBest-of-N settings

Response:

{
  "audio": "Base64-encoded WAV data",
  "format": "base64",
  "sample_rate": 24000,
  "token_count": 123,
  "timings": {
    "llm_sec": 0.5,
    "parse_sec": 0.01,
    "codec_sec": 0.2,
    "total_sec": 0.71,
    "best_of_n_sec": null,
    "asr_sec": null
  },
  "normalized_text": "Preprocessed text"
}

Speech Synthesis (File Upload)

POST /v1/tts/file
Content-Type: multipart/form-data

Form Fields:

Either reference_audio or reference_preset_id is required.

FieldTypeRequiredDescription
textstringYesText to synthesize
reference_audiofileConditionalRequired when reference_preset_id is not specified
reference_preset_idstringConditionalRequired when reference_audio is not specified
modelstringNoLLM model name
temperaturefloatNoTemperature
top_pfloatNoTop-P
max_tokensintNoMaximum generation tokens
repetition_penaltyfloatNoRepetition Penalty
presence_penaltyfloatNoPresence Penalty
frequency_penaltyfloatNoFrequency Penalty
output_formatstringNowav or base64
best_of_n_enabledbooleanNoEnable Best-of-N
best_of_n_nintNoValue of N
best_of_n_languagestringNoLanguage setting for Best-of-N

Response:

  • output_format=wav: WAV file (audio/wav)
  • output_format=base64: JSON response

License & Credits

  • Code: MIT License
  • Default presets: The default presets under presets use audio generated by T5Gemma-TTS and gemini-2.5-pro-tts, so audio synthesized using these presets cannot be used commercially.
  • Models: Please follow the license of each model.