### Flash-TTS Environment Setup Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/server/client.md Installs necessary Python packages for the Flash-TTS client and defines the base URL for the service. Essential for running the provided Python examples. ```bash pip install requests pyaudio openai ``` ```python BASE_URL = "http://127.0.0.1:8000" ``` -------------------------------- ### Install Flash-TTS from Source Source: https://github.com/huiresearch/flashtts/blob/master/docs/zh/get_started/installation.md Installs Flash-TTS by cloning the repository and installing from local source. This is useful for development or when needing the latest unreleased features. ```Bash git clone https://github.com/HuiResearch/FlashTTS.git cd FlashTTS pip install . ``` -------------------------------- ### Install vLLM Inference Backend Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/get_started/installation.md Installs the vLLM inference backend, recommended for its performance. Requires version 0.7.2 or higher. The example shows installation for CUDA 12.4. ```bash pip install vllm ``` -------------------------------- ### Install sglang Inference Backend Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/get_started/installation.md Installs the sglang inference backend. Users are directed to the official sglang documentation for more detailed installation instructions. ```bash pip install sglang ``` -------------------------------- ### Install Flash-TTS from Source Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/get_started/installation.md Installs Flash-TTS by cloning the repository from GitHub and building it locally. This method is useful for development or when needing the latest unreleased features. ```bash git clone https://github.com/HuiResearch/FlashTTS.git cd FlashTTS pip install . ``` -------------------------------- ### Install llama-cpp-python Inference Backend Source: https://github.com/huiresearch/flashtts/blob/master/docs/zh/get_started/installation.md Installs the llama-cpp-python library, which allows running LLMs using the llama.cpp framework. This is suitable for CPU inference or specific hardware setups. ```Bash pip install llama-cpp-python ``` -------------------------------- ### AutoEngine Initialization Example Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/inference/auto-engine.md Illustrates the initialization process of the AutoEngine, showing the configuration details passed to the engine. ```Python Initializing `AutoEngine(engine=spark)` with config: (model_path='…', max_length=32768, …) ``` -------------------------------- ### Install mlx-lm Inference Backend Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/get_started/installation.md Installs the mlx-lm library, specifically for Apple Silicon hardware. Further information is available on the mlx-lm GitHub project. ```bash pip install mlx-lm ``` -------------------------------- ### Install Flash-TTS via Pip Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/get_started/installation.md Installs the Flash-TTS package directly from the Python Package Index (PyPI). ```bash pip install flashtts ``` -------------------------------- ### Install mlx-lm Inference Backend Source: https://github.com/huiresearch/flashtts/blob/master/docs/zh/get_started/installation.md Installs the mlx-lm library, specifically for running models on Apple Silicon hardware using the MLX framework. This is an Apple-specific backend. ```Bash pip install mlx-lm ``` -------------------------------- ### Install WeTextProcessing for Windows Source: https://github.com/huiresearch/flashtts/blob/master/docs/zh/get_started/installation.md Provides a workaround for Windows users experiencing compilation errors with WeTextProcessing by installing pynini via Conda first. ```Bash conda install -c conda-forge pynini==2.1.6 pip install WeTextProcessing==1.0.4.1 ``` -------------------------------- ### Install PyTorch Source: https://github.com/huiresearch/flashtts/blob/master/docs/zh/get_started/installation.md Installs PyTorch and Torchaudio with specific version and CUDA support. This is a prerequisite for many machine learning tasks, including running Flash-TTS with GPU acceleration. ```Bash pip install torch==2.6.0 torchaudio==2.6.0 --index-url https://download.pytorch.org/whl/cu124 ``` -------------------------------- ### Install sglang Inference Backend Source: https://github.com/huiresearch/flashtts/blob/master/docs/zh/get_started/installation.md Installs the sglang library, an inference engine designed for efficient serving of LLMs. It provides a Python API for model interaction. ```Bash pip install sglang ``` -------------------------------- ### Verify TensorRT-LLM Installation Source: https://github.com/huiresearch/flashtts/blob/master/docs/zh/get_started/installation.md Checks if the TensorRT-LLM library is installed correctly by printing its version. This is a simple verification step after installation. ```Python python -c "import tensorrt_llm; print(tensorrt_llm.__version__)" ``` -------------------------------- ### Server Startup Arguments (`server.py`) Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/server/server.md Configuration options for starting the FlashTTS server. These arguments control model loading, backend selection, device allocation, and various performance parameters. ```APIDOC Server Startup Arguments: --model_path (str): Required. Path to the TTS model directory. --backend (str): Required. TTS backend engine. Options: `llama-cpp`, `vllm`, `sglang`, `torch`, `mlx-lm`, `tensorrt-llm`. --snac_path (str): Path to OrpheusTTS SNAC module. Required only if model is `orpheus`. Default: None. --llm_tensorrt_path (str): Path to the TensorRT model. Only effective when the backend is set to `tensorrt-llm`. If not provided, defaults to `{model_path}/tensorrt-engine`. Default: None. --role_dir (str): Directory for role audio references. Default: `data/roles` for Spark, `data/mega-roles` for Mega. --api_key (str): API key for access. All requests must include `Authorization: Bearer ` if enabled. Default: None. --llm_device (str): Device for running the LLM (e.g., `cpu`, `cuda`). Default: `auto`. --tokenizer_device (str): Device for the audio tokenizer. Default: `auto`. --detokenizer_device (str): Device for the audio detokenizer. Default: `auto`. --wav2vec_attn_implementation (str): Attention implementation for `wav2vec` in Spark-TTS. Options: `sdpa`, `flash_attention_2`, `eager`. Default: `eager`. --llm_attn_implementation (str): Attention method for LLM (torch backend). Options: `sdpa`, `flash_attention_2`, `eager`. Default: `eager`. --max_length (int): Max LLM context length. Default: 32768. --llm_gpu_memory_utilization (float): GPU memory usage ratio (for `vllm`/`sglang`). Default: 0.6. --torch_dtype (str): Model precision type. Options: `float16`, `bfloat16`, `float32`, `auto`. Default: `auto`. --cache_implementation (str): Cache strategy for `torch` backend: `static`, `offloaded_static`, `sliding_window`, etc. Default: None. --seed (int): Random seed. Default: 0. --batch_size (int): Max batch size for audio processing. Default: 1. --llm_batch_size (int): Max LLM batch size. Default: 256. --wait_timeout (float): Timeout (in seconds) for dynamic batching. Default: 0.01. ``` -------------------------------- ### Install vLLM Inference Backend Source: https://github.com/huiresearch/flashtts/blob/master/docs/zh/get_started/installation.md Installs the vLLM library, a high-throughput and memory-efficient inference engine for large language models. It's recommended for Flash-TTS. ```Bash pip install vllm ``` -------------------------------- ### Example Initialization Log Source: https://github.com/huiresearch/flashtts/blob/master/docs/zh/inference/auto-engine.md An example log output showing the initialization process of an AutoEngine with specific configuration parameters. ```python Initializing `AutoEngine(engine=spark)` with config: (model_path='…', max_length=32768, …) ``` -------------------------------- ### Initialize and Use AutoEngine for Speech Synthesis Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/inference/auto-engine.md Demonstrates how to initialize the AutoEngine with various configuration parameters for LLM and audio processing devices, backend, and precision. It then shows an asynchronous example of synthesizing speech using the `speak_async` method, specifying text and synthesis parameters like pitch and speed, and finally writing the generated audio to a file. ```python import asyncio from flashtts import AutoEngine # Assume checkpoints/YourModelDir corresponds to a Spark, Orpheus, or Mega model engine = AutoEngine( model_path="checkpoints/YourModelDir", snac_path=None, # Required for Orpheus if `snac` subdirectory is not present lang="mandarin", # Only used by Orpheus llm_device="cuda", # LLM computation device tokenizer_device="cuda", # Audio tokenizer device (Spark/Mega) detokenizer_device="cuda", # Audio detokenizer device (Spark/Orpheus) backend="vllm", # LLM backend accelerator torch_dtype="float32", # LLM weight precision batch_size=1, llm_batch_size=256, wait_timeout=0.01, seed=42 ) async def main(): # Basic synthesis example (Spark shown, but Orpheus/Mega also supported) wav = await engine.speak_async( text="Hello, world!", name="female", # Spark built-in role “female” pitch="moderate", # Spark only speed="moderate", # Spark only temperature=0.9, top_k=50, top_p=0.95 ) engine.write_audio(wav, "output.wav") if __name__ == '__main__': asyncio.run(main()) ``` -------------------------------- ### Install Flash-TTS Source: https://github.com/huiresearch/flashtts/blob/master/docs/zh/get_started/installation.md Installs the Flash-TTS library using pip. This is the primary method for adding Flash-TTS to your Python environment. ```Bash pip install flashtts ``` -------------------------------- ### Start MegaTTS3 Server with vLLM Backend Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/server/server.md Command to start the Flash-TTS backend server using the MegaTTS3 model with the vLLM backend. It includes model path, device configuration, attention implementation, data type, and network settings. ```bash flashtts serve \ --model_path MegaTTS3 \ --backend vllm \ --llm_device cuda \ --tokenizer_device cuda \ --llm_attn_implementation sdpa \ --torch_dtype "float16" \ --max_length 8192 \ --llm_gpu_memory_utilization 0.6 \ --host 0.0.0.0 \ --port 8000 ``` -------------------------------- ### Install llama-cpp-python Inference Backend Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/get_started/installation.md Installs the llama-cpp-python library, which is used for running models compatible with the GGUF format. It also includes commands for converting Hugging Face models to GGUF. ```bash pip install llama-cpp-python ``` ```bash git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp python convert_hf_to_gguf.py Spark-TTS-0.5B/LLM --outfile Spark-TTS-0.5B/LLM/model.gguf ``` -------------------------------- ### Install TensorRT-LLM Inference Backend Source: https://github.com/huiresearch/flashtts/blob/master/docs/zh/get_started/installation.md Installs the TensorRT-LLM library, NVIDIA's optimized inference solution for LLMs. It requires specific CUDA versions and provides high performance on NVIDIA GPUs. ```Bash pip install tensorrt-llm --extra-index-url https://pypi.nvidia.com --extra-index-url https://download.pytorch.org/whl/cu124 ``` -------------------------------- ### Windows Specific Dependency Installation Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/get_started/installation.md Provides commands for Windows users who encounter compilation errors with WeTextProcessing. It involves installing pynini via Conda and then WeTextProcessing via pip. ```bash conda install -c conda-forge pynini==2.1.6 pip install WeTextProcessing==1.0.4.1 ``` -------------------------------- ### FlashTTS Infer Basic Synthesis Example Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/get_started/quick_start.md Demonstrates a basic text-to-speech synthesis using the `flashtts infer` command with essential parameters. ```bash flashtts infer \ -i "Quick start demo." -m ./models/spark-tts \ -b vllm \ -o demo.wav ``` -------------------------------- ### Start Flash-TTS Backend Services Source: https://github.com/huiresearch/flashtts/blob/master/docs/zh/server/server.md Commands to start the Flash-TTS backend server for different TTS models like Spark-TTS, MegaTTS3, and Orpheus-TTS. These commands specify model paths, backend engines (e.g., vllm, torch), device configurations, and other runtime parameters. Ensure the correct model path and backend are selected for your deployment. ```bash flashtts serve \ --model_path Spark-TTS-0.5B \ --backend vllm \ --llm_device cuda \ --tokenizer_device cuda \ --detokenizer_device cuda \ --wav2vec_attn_implementation sdpa \ --llm_attn_implementation sdpa \ --torch_dtype "bfloat16" \ --max_length 32768 \ --llm_gpu_memory_utilization 0.6 \ --fix_voice \ --host 0.0.0.0 \ --port 8000 ``` ```bash flashtts serve \ --model_path MegaTTS3 \ --backend vllm \ --llm_device cuda \ --tokenizer_device cuda \ --llm_attn_implementation sdpa \ --torch_dtype "float16" \ --max_length 8192 \ --llm_gpu_memory_utilization 0.6 \ --host 0.0.0.0 \ --port 8000 ``` ```bash flashtts serve \ --model_path orpheus-3b-0.1-ft-bf16 \ --snac_path snac_24khz \ --lang english \ --backend vllm \ --llm_device cuda \ --detokenizer_device cuda \ --llm_attn_implementation sdpa \ --torch_dtype "float16" \ --max_length 8192 \ --llm_gpu_memory_utilization 0.6 \ --host 0.0.0.0 \ --port 8000 ``` -------------------------------- ### Start Spark-TTS Server with vLLM Backend Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/server/server.md Command to start the Flash-TTS backend server using the Spark-TTS model with the vLLM backend. It specifies model path, device settings, attention implementation, data types, and network configuration. ```bash flashtts serve \ --model_path Spark-TTS-0.5B \ --backend vllm \ --llm_device cuda \ --tokenizer_device cuda \ --detokenizer_device cuda \ --wav2vec_attn_implementation sdpa \ --llm_attn_implementation sdpa \ --torch_dtype "bfloat16" \ --max_length 32768 \ --llm_gpu_memory_utilization 0.6 \ --fix_voice \ --host 0.0.0.0 \ --port 8000 ``` -------------------------------- ### Install PyTorch for CUDA 12.4 Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/get_started/installation.md Installs PyTorch and Torchaudio for CUDA 12.4. Users should visit the official PyTorch website to obtain the command suitable for their specific system and CUDA version. ```bash pip install torch==2.6.0 torchaudio==2.6.0 --index-url https://download.pytorch.org/whl/cu124 ``` -------------------------------- ### Voice Cloning Workflow Example (cURL) Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/server/server.md Demonstrates how to perform voice cloning using a cURL command. It specifies the endpoint, authorization, text input, reference audio file, and output format. ```bash curl -X POST http://localhost:8000/clone_voice \ -H "Authorization: Bearer YOUR_API_KEY" \ -F "text=Hello, world" \ -F "reference_audio_file=@/path/to/ref.wav" \ -F "stream=false" \ -F "response_format=wav" \ --output output.wav ``` -------------------------------- ### FlashTTS Infer SparkTTS Voice Cloning Example Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/get_started/quick_start.md Shows how to perform voice cloning using the SparkTTS model by providing a reference audio file. ```bash flashtts infer \ -i "Voice cloning sample." -m ./models/spark-tts \ -b vllm \ --reference_audio ref.wav \ -o clone.wav ``` -------------------------------- ### FlashTTS Infer MegaTTS3 Voice Cloning Example Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/get_started/quick_start.md Illustrates voice cloning with the MegaTTS3 model, requiring both a reference audio file and its corresponding latent file. ```bash flashtts infer \ -i "Voice cloning sample." -m ./models/mega-tts3 \ -b vllm \ --reference_audio ref.wav \ --latent_file ref_latent.npy \ -o clone_mega.wav ``` -------------------------------- ### Verify TensorRT-LLM Installation Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/get_started/installation.md Verifies the installation of the TensorRT-LLM package by importing it and printing its version. This confirms that the package is correctly installed and accessible in the Python environment. ```python python -c "import tensorrt_llm; print(tensorrt_llm.__version__)" ``` -------------------------------- ### FlashTTS Infer CLI Example Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/get_started/quick_start.md Demonstrates a basic command-line invocation for FlashTTS inference. It specifies input text, an output file, and the model path, with an option to select an inference backend. ```bash flashtts infer \ -i "Hello, welcome to speech synthesis." \ -o output.wav \ -m ./models/your_model \ -b vllm \ [other optional parameters] ``` -------------------------------- ### API: AsyncMega3Engine Initialization Parameters Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/inference/mega-tts.md Details the parameters required for initializing the AsyncMega3Engine, which is the core component for text-to-speech synthesis. These parameters control model loading, device placement, and performance settings. ```APIDOC AsyncMega3Engine: __init__(model_path: str, max_length: int = 32768, llm_device: str = "auto", tokenizer_device: str = "auto", backend: str = "torch", llm_attn_implementation: str = "eager", torch_dtype: str = "auto", llm_gpu_memory_utilization: float = 0.6, batch_size: int = 1, llm_batch_size: int = 256, wait_timeout: float = 0.01, seed: int = 0, --llm_tensorrt_path: str = None) Parameters: model_path (str): Path to the model root directory. max_length (int, optional): Max context length for LLM. Defaults to 32768. llm_device (str, optional): LLM computation device. Defaults to "auto". tokenizer_device (str, optional): Tokenizer device. Defaults to "auto". backend (str, optional): Backend for LLM inference. Options: `torch`, `vllm`, `sglang`, `llama-cpp`, `mlx-lm`, `tensorrt-llm`. Defaults to "torch". llm_attn_implementation (str, optional): LLM attention implementation. Defaults to "eager". torch_dtype (str, optional): LLM weight precision. Options: `float16`, `bfloat16`, `float32`. Defaults to "auto". llm_gpu_memory_utilization (float, optional): Max GPU memory utilization. Only effective for `vllm`/`sglang` backends. Defaults to 0.6. batch_size (int, optional): Batch size for tokenizer/detokenizer. Defaults to 1. llm_batch_size (int, optional): Batch size for LLM decoding. Defaults to 256. wait_timeout (float, optional): Async wait timeout for tokenizer/detokenizer. Defaults to 0.01. seed (int, optional): Random seed for reproducibility. Defaults to 0. --llm_tensorrt_path (str, optional): Path to the TensorRT model. Only used when `backend` is `tensorrt-llm`. Defaults to `{model_path}/tensorrt-engine` if not provided. ``` -------------------------------- ### Install TensorRT-LLM for CUDA 12.4 Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/get_started/installation.md Installs the TensorRT-LLM Python package with specific CUDA 12.4 support from NVIDIA's PyPI repository. It also includes PyTorch for CUDA 12.4. Notes mention Windows Python version limitations and supported versions. ```bash pip install tensorrt-llm --extra-index-url https://pypi.nvidia.com --extra-index-url https://download.pytorch.org/whl/cu124 ``` -------------------------------- ### FlashTTS Launch Parameters Source: https://github.com/huiresearch/flashtts/blob/master/docs/zh/server/server.md Defines the command-line arguments used to configure and launch the FlashTTS TTS engine. It covers model paths, backend selection, device configuration, and various operational settings. ```APIDOC FlashTTS Launch Parameters: --model_path (str): Required. Path to the TTS model directory. --backend (str): Required. Synthesis engine type. Options: `llama-cpp`, `vllm`, `sglang`, `torch`, `mlx-lm`, `tensorrt-llm`. --snac_path (str): Path to the SNAC module for OrpheusTTS. Used only when model is `orpheus`. Default: None. --llm_tensorrt_path (str): Path to the TensorRT LLM model. Effective only when backend is `tensorrt-llm`. Defaults to `{model_path}/tensorrt-engine` if not provided. --role_dir (str): Directory for loading role audio references. Defaults to `data/roles` for Spark engine and `data/mega-roles` for Mega engine. --api_key (str): API access key. If enabled, requests must include `Authorization: Bearer ` header. Default: None. --llm_device (str): Device for LLM execution (e.g., `cpu`, `cuda`). Default: `auto`. --tokenizer_device (str): Device for the audio tokenizer. Default: `auto`. --detokenizer_device (str): Device for the audio detokenizer. Default: `auto`. --wav2vec_attn_implementation (str): Attention implementation for the `wav2vec` module in `spark-tts` models. Options: `sdpa`, `flash_attention_2`, `eager`. Default: `eager`. --llm_attn_implementation (str): Attention implementation for LLM when backend is `torch`. Options: `sdpa`, `flash_attention_2`, `eager`. Default: `eager`. --max_length (int): Maximum context length for the LLM. Default: 32768. --llm_gpu_memory_utilization (float): GPU memory utilization ratio for `vllm`/`sglang`. Default: 0.6. --torch_dtype (str): Model precision type. Options: `float16`, `bfloat16`, `float32`, `auto`. Default: `auto`. --cache_implementation (str): Generation cache implementation for `torch` backend. Options: `static`, `offloaded_static`, `sliding_window`, `hybrid`, `mamba`, etc. Default: None. --seed (int): Random seed. Default: 0. --batch_size (int): Maximum batch size for audio processing components. Default: 1. --llm_batch_size (int): Maximum batch size for LLM. Default: 256. --wait_timeout (float): Timeout in seconds for dynamic batching requests. Default: 0.01. --host (str): Service listening address. Default: `0.0.0.0`. --port (int): Service listening port. Default: 8000. --fix_voice (bool): Whether to fix the built-in voice of the spark-tts model. Default: False. ``` -------------------------------- ### Start Orpheus-TTS Server with vLLM Backend Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/server/server.md Command to start the Flash-TTS backend server using the Orpheus-TTS model with the vLLM backend. It specifies model path, SNAC path, language, device settings, attention implementation, data type, and network configuration. ```bash flashtts serve \ --model_path orpheus-3b-0.1-ft-bf16 \ --snac_path snac_24khz \ --lang english \ --backend vllm \ --llm_device cuda \ --detokenizer_device cuda \ --llm_attn_implementation sdpa \ --torch_dtype "float16" \ --max_length 8192 \ --llm_gpu_memory_utilization 0.6 \ --host 0.0.0.0 \ --port 8000 ``` -------------------------------- ### Convert Hugging Face Model to GGUF Source: https://github.com/huiresearch/flashtts/blob/master/docs/zh/get_started/installation.md Converts Hugging Face model weights to the GGUF format using the llama.cpp conversion script. This is necessary for using GGUF models with llama-cpp-python. ```Bash git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp python convert_hf_to_gguf.py Spark-TTS-0.5B/LLM --outfile Spark-TTS-0.5B/LLM/model.gguf ``` -------------------------------- ### Initialize Orpheus-TTS Engine Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/inference/orpheus-tts.md Demonstrates how to initialize the AsyncOrpheusEngine with model paths, device configurations, and backend settings. This is the first step before performing any speech synthesis tasks. ```python from flashtts import AsyncOrpheusEngine def prepare_engine(): engine = AsyncOrpheusEngine( model_path="checkpoints/orpheus-3b-0.1-ft", snac_path="checkpoints/snac_24khz", max_length=8192, llm_device="cuda", detokenizer_device="cuda", backend="vllm" ) return engine ``` -------------------------------- ### Get Available Roles API: GET /audio_roles or GET /v1/audio_roles Source: https://github.com/huiresearch/flashtts/blob/master/docs/zh/server/server.md Retrieves a list of available speaker roles that can be used for synthesis. ```APIDOC GET /audio_roles GET /v1/audio_roles Response Example: { "success": true, "roles": ["alice", "bob", "tara"] } ``` -------------------------------- ### Streaming Output Source: https://github.com/huiresearch/flashtts/blob/master/docs/zh/inference/spark-tts.md Provides an example of streaming audio output for speech synthesis. The `speak_stream_async` method yields audio chunks iteratively, which can be collected and processed, for example, by concatenating them into a full audio array. ```python chunks = [] async for chunk in engine.speak_stream_async(text, name="female"): chunks.append(chunk) audio = np.concatenate(chunks) engine.write_audio(audio, "stream.wav") ``` -------------------------------- ### Initialize MegaTTS3 Engine Source: https://github.com/huiresearch/flashtts/blob/master/docs/en/inference/mega-tts.md Initializes the AsyncMega3Engine for MegaTTS3 inference. It requires specifying the model path and devices for the LLM and tokenizer, along with the backend and torch dtype. ```python from flashtts import AsyncMega3Engine engine = AsyncMega3Engine( model_path="checkpoints/MegaTTS3", llm_device="cuda", tokenizer_device="cuda", backend="vllm", # Options: torch, vllm, sglang, llama-cpp, mlx-lm torch_dtype="float16" # MegaTTS supports all precision types ) ```