Views
No views yet
from_pretrained() call may be very slow or timeout.1# Install git-xet for faster cloning (https://hf.co/docs/hub/git-xet)
2brew install git-xet
3git xet install
4
5# Install HuggingFace CLI
6curl -LsSf https://hf.co/cli/install.sh | bash1# Clone with all model files (18GB download)
2git clone https://huggingface.co/Roland-JAAI/klonaudio1# Clone without downloading large files initially - just their pointers
2GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/Roland-JAAI/klonaudio
3
4# Then download the model files using HF CLI (faster and more reliable)
5hf auth login --token <your-token>
6hf download Roland-JAAI/klonaudio1# Authenticate
2hf auth login --token <your-token>
3
4# Download just the model files to HuggingFace cache
5hf download Roland-JAAI/klonaudiofrom_pretrained() will use the cached files instantly.1import torch
2from transformers import AutoModelForCausalLM, AutoProcessor
3
4# Device selection (CUDA > MPS > CPU)
5if torch.cuda.is_available():
6 device = "cuda"
7 dtype = torch.bfloat16
8elif hasattr(torch.backends, "mps") and torch.backends.mps.is_available():
9 device = "mps"
10 dtype = torch.float32 # MPS doesn't support bfloat16 well
11else:
12 device = "cpu"
13 dtype = torch.float32
14
15print(f"Using device: {device}")
16
17# Load model and processor (uses cached files if you pre-downloaded)
18model = AutoModelForCausalLM.from_pretrained(
19 "Roland-JAAI/klonaudio",
20 trust_remote_code=True,
21 torch_dtype=dtype,
22).to(device)
23model.eval()
24
25processor = AutoProcessor.from_pretrained(
26 "Roland-JAAI/klonaudio",
27 trust_remote_code=True
28)
29
30# See available pre-encoded voices
31print(processor.get_available_voices()) # ["radio", "angry", "old_lady"]
32
33# Generate speech with a named voice
34inputs = processor(
35 text="Guten Abend. Hier sind die Nachrichten.",
36 voice="radio",
37 return_tensors="pt"
38)
39inputs = {k: v.to(device) if isinstance(v, torch.Tensor) else v for k, v in inputs.items()}
40
41with torch.no_grad():
42 outputs = model.generate(**inputs, cfg_scale=3.0, max_new_tokens=2048)
43
44# Save audio
45processor.save_audio(outputs.speech_outputs[0], "output.wav")1# Clone from audio file (requires encoders - don't call strip_encoders())
2inputs = processor(
3 text="Your text here",
4 voice_prompt="path/to/reference_audio.wav",
5 return_tensors="pt"
6)
7inputs = {k: v.to(device) if isinstance(v, torch.Tensor) else v for k, v in inputs.items()}
8
9with torch.no_grad():
10 outputs = model.generate(**inputs, cfg_scale=3.0, max_new_tokens=2048)
11
12processor.save_audio(outputs.speech_outputs[0], "cloned_output.wav")| Voice | Description | Best For |
|---|---|---|
radio | Professional radio announcer | Default/professional content |
angry | Angry, frustrated speech | Emotional dialogue |
old_lady | Gentle elderly female | Storytelling/warm content |
Note: Quality varies by language. German, Spanish, French, and English have the best coverage from ~200,000 hours of training data (YODAS2 dataset).
preprocessor_config.json and tokenizer_config.json1@misc{klonaudio2026,
2 title={KlonAudio: Open-Source TTS with Voice Cloning for European Languages},
3 author={Roland Becker},
4 year={2026},
5 url={https://github.com/RolandJAAI/klonaudio}
6}
7
8@misc{kugelaudio2025,
9 title={KugelAudio: Open-Source Text-to-Speech Model},
10 author={Kajo Kratzenstein and Carlos Menke},
11 year={2025},
12 url={https://github.com/Kugelaudio/kugelaudio-open}
13}