Skip to main content

rlx_kittentts/
lib.rs

1// RLX — versatile ML compiler + runtime.
2// Copyright (C) 2026 Eugene Hauptmann, Nataliya Kosmyna.
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, version 3.
7//
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11// GNU General Public License for more details.
12//
13// You should have received a copy of the GNU General Public License
14// along with this program. If not, see <https://www.gnu.org/licenses/>.
15
16//! KittenTTS — lightweight ONNX text-to-speech for RLX.
17//!
18//! ## Backends
19//!
20//! | Feature | RLX runtime | ONNX Runtime EP        |
21//! |---------|-------------|------------------------|
22//! | `onnx`  | —           | CPU (default)          |
23//! | `native`| RLX runtime | Decomposed `kitten_tts_mini_rlx` graph (no ORT) |
24//! | `rlx`   | RLX runtime | ORT inference + RLX path deps for future parity |
25//! | `metal` | Metal       | CoreML (macOS / iOS)   |
26//! | `mlx`   | MLX         | CoreML (Apple GPU)     |
27//! | `cuda`  | CUDA        | CUDA                   |
28//! | `rocm`  | ROCm        | ROCm                   |
29//! | `gpu`   | wgpu        | DirectML / CUDA / CoreML |
30//! | `full`  | all above   | all ORT EPs + RLX path deps |
31
32pub mod assets;
33#[cfg(feature = "onnx")]
34pub mod backend;
35pub mod backend_kind;
36pub mod cli;
37pub mod config;
38pub mod download;
39pub mod features;
40pub mod infer_opts;
41pub mod model;
42#[cfg(feature = "native")]
43pub mod native;
44pub mod npz;
45pub mod phonemize;
46#[cfg(feature = "espeak")]
47pub mod preprocess;
48pub mod tokenize;
49
50pub use assets::{
51    DEFAULT_LOCAL_DIR, ModelLayout, default_model_dir, default_native_weights_dir,
52    find_native_weights, find_rlx_bundle,
53};
54#[cfg(feature = "onnx")]
55pub use backend::{OrtSession, build_onnx_session, execution_providers_for, validate_device};
56pub use config::{DEFAULT_HF_REPO, ModelConfig};
57pub use download::{fetch_default, fetch_to_local_dir};
58pub use features::{
59    cuda_feature_enabled, enabled_backend_labels, espeak_feature_enabled, gpu_feature_enabled,
60    metal_feature_enabled, mlx_feature_enabled, native_feature_enabled, onnx_feature_enabled,
61    rlx_feature_enabled, rocm_feature_enabled,
62};
63pub use infer_opts::{SAMPLES_PER_DURATION_UNIT, recommended_native_compile_opts};
64pub use model::{KittenTTS, MIN_AUDIBLE_PEAK, SAMPLE_RATE, peak_amplitude};
65pub use npz::{NpyArray, load_npz, parse_npy};
66pub use phonemize::{DEFAULT_LANG, is_espeak_available, phonemize, phonemize_lang, set_data_path};
67pub use rlx_runtime::{Device, fastest_device, is_available, parse_device, parse_device_list};
68pub use tokenize::{
69    ipa_content_len, ipa_style_index, ipa_text_style_index, ipa_to_ids, warn_unknown_ipa_chars,
70};