Views
No views yet
| File | Description |
|---|---|
ahsoka-final.onnx | ONNX model for inference |
ahsoka-final.json | Model config (sample rate, phoneme map, inference params) |
ahsoka-final.ckpt | PyTorch Lightning checkpoint (for continued training) |
dataset.jsonl | Training dataset (1019 samples) |
dataset.jsonl.gz | Compressed dataset |
1# Clone and build from source
2git clone https://github.com/rhasspy/piper.git
3cd piper
4./build.sh1mkdir -p ~/.local/share/piper-voices/ahsoka
2cd ~/.local/share/piper-voices/ahsoka
3
4# Download from HuggingFace
5wget https://huggingface.co/crazygiscool/ahsoka-piper-voice/resolve/main/ahsoka-final.onnx
6wget https://huggingface.co/crazygiscool/ahsoka-piper-voice/resolve/main/ahsoka-final.json1# Pipe text in
2echo "Hello, I am Ahsoka Tano" | piper --model ~/.local/share/piper-voices/ahsoka/ahsoka-final.onnx --output_file output.wav
3
4# Or specify text directly
5piper --model ~/.local/share/piper-voices/ahsoka/ahsoka-final.onnx --text "The force is strong with this one" --output_file output.wavpip install piper-tts piper-phonemize torch soundfile1import soundfile as sf
2import piper_phonemize
3import onnxruntime as ort
4import numpy as np
5
6# Load model
7session = ort.InferenceSession("ahsoka-final.onnx")
8
9# Phonemize text
10text = "I am Ahsoka Tano"
11phonemes = piper_phonemize.phonemize_espeak(text, "en-us")
12phoneme_ids = piper_phonemize.phoneme_ids_espeak([p for seq in phonemes for p in seq])
13
14# Add padding (required format: [BOS, 0, phoneme, 0, phoneme, ..., EOS])
15ids = [0] + [p for pid in phoneme_ids for p in [0, pid]] + [0]
16
17# Inference
18x = np.array([ids], dtype=np.int64)
19x_len = np.array([len(ids)], dtype=np.int64)
20scales = np.array([0.667, 1.0, 0.8], dtype=np.float32)
21
22audio = session.run(None, {
23 "input": x,
24 "input_lengths": x_len,
25 "noise_scale": scales[:1],
26 "length_scale": scales[1:2],
27 "noise_w": scales[2:],
28})[0]
29
30# Save
31sf.write("output.wav", audio[0, 0], 22050)1import torch
2from piper_train.vits.lightning import VitsModel
3
4model = VitsModel.load_from_checkpoint("ahsoka-final.ckpt", dataset=None)
5model_g = model.model_g
6model_g.eval()
7
8with torch.no_grad():
9 model_g.dec.remove_weight_norm()
10 # (same phonemize + inference code as above)| Parameter | Default | Range | Description |
|---|---|---|---|
noise_scale | 0.667 | 0.0 - 1.0 | Phoneme noise (variation) |
length_scale | 1.0 | 0.5 - 2.0 | Speaking speed (lower = faster) |
noise_w | 0.8 | 0.0 - 1.0 | Phoneme width noise |
dataset.jsonl contains:{"text": "Transcription text", "audio_filename": "relative/path/to/audio.wav"}