Upload folder using huggingface_hub
Browse files
.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
ISSUES.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Piper TTS Training & Inference: Native Solutions Guide
|
| 2 |
+
|
| 3 |
+
## 1. The Dataset "Missing Phoneme" Bug (Core Issue)
|
| 4 |
+
|
| 5 |
+
**The Symptom:** During training preprocessing (`dataset_type: "text"`), Piper spams warnings like `Missing phoneme from id map: л` even though you provided a correct `phonemes.json` file.
|
| 6 |
+
**The "Hacker" Fix:** Writing a 40-line Python script to manually convert your entire dataset text into integer IDs, and switching the dataset type to bypass phonemization entirely.
|
| 7 |
+
|
| 8 |
+
**The Root Cause:**
|
| 9 |
+
By looking at the `dataset.py` and `phoneme_ids.py` files you provided, we can see the exact bug.
|
| 10 |
+
|
| 11 |
+
1. On line 142 of `dataset.py`, Piper successfully loads your Ukrainian phonemes into the variable `phoneme_id_map`.
|
| 12 |
+
2. However, on line 311 of `dataset.py`, it calls the conversion function:
|
| 13 |
+
```python
|
| 14 |
+
phonemes_to_ids(sentence_phonemes)
|
| 15 |
+
```
|
| 16 |
+
3. Looking at `phoneme_ids.py`, the function is defined as:
|
| 17 |
+
```python
|
| 18 |
+
def phonemes_to_ids(phonemes: list[str], id_map: Optional[Mapping[str, Sequence[int]]] = None) -> list[int]:
|
| 19 |
+
if not id_map:
|
| 20 |
+
id_map = DEFAULT_PHONEME_ID_MAP # <--- The English defaults!
|
| 21 |
+
```
|
| 22 |
+
Because Piper's `dataset.py` forgets to pass your custom map into the function, it falls back to English, fails to find Ukrainian letters, and throws warnings.
|
| 23 |
+
|
| 24 |
+
**The Smart Native Fix:**
|
| 25 |
+
Instead of modifying your dataset, just fix the 1-line bug in `src/piper/train/vits/dataset.py` (around line 311). Change it to pass the map:
|
| 26 |
+
|
| 27 |
+
```python
|
| 28 |
+
# Change this (Line 311):
|
| 29 |
+
phonemes_to_ids(sentence_phonemes)
|
| 30 |
+
|
| 31 |
+
# To this:
|
| 32 |
+
phonemes_to_ids(sentence_phonemes, id_map=self.piper_config.phoneme_id_map)
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
_Result:_ You can now train using your normal, readable `metadata.csv` directly without pre-processing it.
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
## 2. The Unresolved "t, e, x, t" Inference Mystery
|
| 40 |
+
|
| 41 |
+
**The Symptom:** When running Piper for inference, you got warnings for missing letters `t`, `e`, `x`, `t` even though your input was `"привіт, як справи?"`.
|
| 42 |
+
**The "Hacker" Fix:** The previous AI gave up on the CLI tool and wrote a massive custom Python script utilizing `onnxruntime` and `scipy.io.wavfile` to generate the audio, battling tensor data types along the way.
|
| 43 |
+
|
| 44 |
+
**The Root Cause:**
|
| 45 |
+
The Piper CLI application **does not have a `--text` argument.**
|
| 46 |
+
Because `--text` is not a valid flag, Piper treated `--text` as the actual words you wanted it to speak.
|
| 47 |
+
|
| 48 |
+
1. It successfully processed `привіт, як справи?` using your Ukrainian config.
|
| 49 |
+
2. It then tried to process `--text`, couldn't find the English letters `t`, `e`, `x`, `t` in the Ukrainian config, and threw the warnings!
|
| 50 |
+
|
| 51 |
+
**The Smart Native Fix:**
|
| 52 |
+
Pass the text to Piper using standard input (`echo`) or separate the command arguments using `--`. No custom Python script needed!
|
| 53 |
+
|
| 54 |
+
```bash
|
| 55 |
+
# Option A: Use standard input (Recommended)
|
| 56 |
+
echo "привіт, як справи?" | python3 -m piper --model uk_UA-ASMR/output/uk_UA-asmr-medium.onnx --output-file audio_output.wav
|
| 57 |
+
|
| 58 |
+
# Option B: Use the '--' separator
|
| 59 |
+
python3 -m piper --model uk_UA-ASMR/output/uk_UA-asmr-medium.onnx --output-file audio_output.wav -- "привіт, як справи?"
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
---
|
| 63 |
+
|
| 64 |
+
## 3. PyTorch Lightning Checkpoint Confusion
|
| 65 |
+
|
| 66 |
+
**The Symptom:** During training, checkpoints were not appearing in your `uk_UA-ASMR/output/` directory, causing panic that training wasn't saving.
|
| 67 |
+
**The "Hacker" Fix:** The AI wrongly claimed Lightning won't save without a validation dataset, and told you to stop training to forcefully inject `ModelCheckpoint` callbacks.
|
| 68 |
+
|
| 69 |
+
**The Root Cause:**
|
| 70 |
+
By default, if you don't explicitly pass `--trainer.default_root_dir`, PyTorch Lightning automatically creates a `lightning_logs/` folder in your current directory and saves everything there. It _was_ saving perfectly the entire time.
|
| 71 |
+
|
| 72 |
+
**The Smart Native Fix:**
|
| 73 |
+
Let PyTorch Lightning do its job. Either:
|
| 74 |
+
|
| 75 |
+
1. Retrieve your checkpoints natively from `lightning_logs/version_0/checkpoints/`
|
| 76 |
+
2. Next time you start a new training run, simply tell Lightning where you want them by appending this to your CLI arguments:
|
| 77 |
+
```bash
|
| 78 |
+
--trainer.default_root_dir uk_UA-ASMR/output
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
<details>
|
| 82 |
+
<summary>Usage</summary>
|
| 83 |
+
|
| 84 |
+
```
|
| 85 |
+
usage: __main__.py [-h] -m MODEL [-c CONFIG] [-i INPUT_FILE] [-f OUTPUT_FILE] [-d OUTPUT_DIR]
|
| 86 |
+
[--output-dir-naming {timestamp,text}] [--output-raw]
|
| 87 |
+
[-s SPEAKER] [--length-scale LENGTH_SCALE] [--noise-scale NOISE_SCALE] [--noise-w-scale NOISE_W_SCALE] [--cuda]
|
| 88 |
+
[--sentence-silence SENTENCE_SILENCE] [--volume VOLUME] [--no-normalize] [--data-dir DATA_DIR] [--debug]
|
| 89 |
+
|
| 90 |
+
usage: __main__.py [options] fit [-c CONFIG] [--seed_everything SEED_EVERYTHING]
|
| 91 |
+
[--trainer CONFIG] [--trainer.accelerator ACCELERATOR]
|
| 92 |
+
[--trainer.strategy STRATEGY] [--trainer.devices DEVICES] [--trainer.num_nodes NUM_NODES]
|
| 93 |
+
[--trainer.precision PRECISION] [--trainer.logger LOGGER] [--trainer.callbacks CALLBACKS]
|
| 94 |
+
[--trainer.fast_dev_run FAST_DEV_RUN] [--trainer.max_epochs MAX_EPOCHS] [--trainer.min_epochs MIN_EPOCHS]
|
| 95 |
+
[--trainer.max_steps MAX_STEPS] [--trainer.min_steps MIN_STEPS] [--trainer.max_time MAX_TIME]
|
| 96 |
+
[--trainer.limit_train_batches LIMIT_TRAIN_BATCHES] [--trainer.limit_val_batches LIMIT_VAL_BATCHES]
|
| 97 |
+
[--trainer.limit_test_batches LIMIT_TEST_BATCHES] [--trainer.limit_predict_batches LIMIT_PREDICT_BATCHES]
|
| 98 |
+
[--trainer.overfit_batches OVERFIT_BATCHES] [--trainer.val_check_interval VAL_CHECK_INTERVAL]
|
| 99 |
+
[--trainer.check_val_every_n_epoch CHECK_VAL_EVERY_N_EPOCH] [--trainer.num_sanity_val_steps NUM_SANITY_VAL_STEPS]
|
| 100 |
+
[--trainer.log_every_n_steps LOG_EVERY_N_STEPS] [--trainer.enable_checkpointing {true,false,null}]
|
| 101 |
+
[--trainer.enable_progress_bar {true,false,null}] [--trainer.enable_model_summary {true,false,null}]
|
| 102 |
+
[--trainer.accumulate_grad_batches ACCUMULATE_GRAD_BATCHES] [--trainer.gradient_clip_val GRADIENT_CLIP_VAL]
|
| 103 |
+
[--trainer.gradient_clip_algorithm GRADIENT_CLIP_ALGORITHM] [--trainer.deterministic DETERMINISTIC]
|
| 104 |
+
[--trainer.benchmark {true,false,null}] [--trainer.inference_mode {true,false}]
|
| 105 |
+
[--trainer.use_distributed_sampler {true,false}] [--trainer.profiler PROFILER] [--trainer.detect_anomaly {true,false}]
|
| 106 |
+
[--trainer.barebones {true,false}] [--trainer.plugins PLUGINS] [--trainer.sync_batchnorm {true,false}]
|
| 107 |
+
[--trainer.reload_dataloaders_every_n_epochs RELOAD_DATALOADERS_EVERY_N_EPOCHS]
|
| 108 |
+
[--trainer.default_root_dir DEFAULT_ROOT_DIR] [--trainer.enable_autolog_hparams {true,false}]
|
| 109 |
+
[--trainer.model_registry MODEL_REGISTRY] [--model CONFIG] [--model.sample_rate SAMPLE_RATE]
|
| 110 |
+
[--model.num_speakers NUM_SPEAKERS] [--model.resblock RESBLOCK] [--model.resblock_kernel_sizes RESBLOCK_KERNEL_SIZES]
|
| 111 |
+
[--model.resblock_dilation_sizes RESBLOCK_DILATION_SIZES] [--model.upsample_rates UPSAMPLE_RATES]
|
| 112 |
+
[--model.upsample_initial_channel UPSAMPLE_INITIAL_CHANNEL] [--model.upsample_kernel_sizes UPSAMPLE_KERNEL_SIZES]
|
| 113 |
+
[--model.filter_length FILTER_LENGTH] [--model.hop_length HOP_LENGTH] [--model.win_length WIN_LENGTH]
|
| 114 |
+
[--model.mel_channels MEL_CHANNELS] [--model.mel_fmin MEL_FMIN] [--model.mel_fmax MEL_FMAX]
|
| 115 |
+
[--model.inter_channels INTER_CHANNELS] [--model.hidden_channels HIDDEN_CHANNELS]
|
| 116 |
+
[--model.filter_channels FILTER_CHANNELS] [--model.n_heads N_HEADS] [--model.n_layers N_LAYERS]
|
| 117 |
+
[--model.kernel_size KERNEL_SIZE] [--model.p_dropout P_DROPOUT] [--model.n_layers_q N_LAYERS_Q]
|
| 118 |
+
[--model.use_spectral_norm {true,false}] [--model.gin_channels GIN_CHANNELS] [--model.use_sdp {true,false}]
|
| 119 |
+
[--model.segment_size SEGMENT_SIZE] [--model.learning_rate LEARNING_RATE] [--model.learning_rate_d LEARNING_RATE_D]
|
| 120 |
+
[--model.betas [ITEM,...]] [--model.betas_d [ITEM,...]] [--model.eps EPS] [--model.lr_decay LR_DECAY]
|
| 121 |
+
[--model.lr_decay_d LR_DECAY_D] [--model.init_lr_ratio INIT_LR_RATIO] [--model.warmup_epochs WARMUP_EPOCHS]
|
| 122 |
+
[--model.c_mel C_MEL] [--model.c_kl C_KL] [--model.grad_clip GRAD_CLIP]
|
| 123 |
+
[--model.vocoder_warmstart_ckpt VOCODER_WARMSTART_CKPT] [--model.dataset DATASET] [--data CONFIG]
|
| 124 |
+
--data.csv_path CSV_PATH --data.cache_dir CACHE_DIR --data.espeak_voice ESPEAK_VOICE
|
| 125 |
+
--data.config_path CONFIG_PATH --data.voice_name VOICE_NAME [--data.audio_dir AUDIO_DIR]
|
| 126 |
+
[--data.alignments_dir ALIGNMENTS_DIR] [--data.num_symbols NUM_SYMBOLS] [--data.batch_size BATCH_SIZE]
|
| 127 |
+
[--data.validation_split VALIDATION_SPLIT] [--data.num_test_examples NUM_TEST_EXAMPLES] [--data.num_workers NUM_WORKERS]
|
| 128 |
+
[--data.trim_silence {true,false}] [--data.keep_seconds_before_silence KEEP_SECONDS_BEFORE_SILENCE]
|
| 129 |
+
[--data.keep_seconds_after_silence KEEP_SECONDS_AFTER_SILENCE] [--data.phoneme_type PHONEME_TYPE]
|
| 130 |
+
[--data.dataset_type DATASET_TYPE] [--data.phonemes_path PHONEMES_PATH]
|
| 131 |
+
[--optimizer CONFIG | CLASS_PATH_OR_NAME | .INIT_ARG_NAME VALUE]
|
| 132 |
+
[--lr_scheduler CONFIG | CLASS_PATH_OR_NAME | .INIT_ARG_NAME VALUE] [--ckpt_path CKPT_PATH]
|
| 133 |
+
[--weights_only {true,false,null}]
|
| 134 |
+
```
|
| 135 |
+
|
| 136 |
+
</details>
|
README.md
CHANGED
|
@@ -28,15 +28,33 @@ A Ukrainian text-to-speech dataset for training single-speaker ASMR-style voice
|
|
| 28 |
|
| 29 |
## Dataset Structure
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
```
|
| 32 |
-
|
|
|
|
|
|
|
| 33 |
├── README.md
|
| 34 |
├── metadata.csv # Metadata
|
|
|
|
| 35 |
├── audio/ # Audio files (22050 Hz, mono, 16-bit)
|
| 36 |
│ ├── utt_0001.wav
|
| 37 |
│ ├── utt_0002.wav
|
| 38 |
│ └── ...
|
| 39 |
-
└── checkpoints/
|
|
|
|
| 40 |
└── epoch=2090-step=1166778.ckpt
|
| 41 |
```
|
| 42 |
|
|
@@ -60,6 +78,10 @@ source .venv/bin/activate
|
|
| 60 |
python3 -m pip install -e '.[train]'
|
| 61 |
./build_monotonic_align.sh
|
| 62 |
python3 setup.py build_ext --inplace
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
```
|
| 64 |
|
| 65 |
### Training Command
|
|
@@ -67,45 +89,54 @@ python3 setup.py build_ext --inplace
|
|
| 67 |
```bash
|
| 68 |
python3 -m piper.train fit \
|
| 69 |
--data.voice_name "uk_asmr" \
|
| 70 |
-
--data.csv_path uk_UA-ASMR/
|
| 71 |
--data.audio_dir uk_UA-ASMR/audio \
|
| 72 |
--data.espeak_voice "uk" \
|
| 73 |
--model.sample_rate 22050 \
|
| 74 |
--data.phoneme_type "text" \
|
| 75 |
-
--data.dataset_type "
|
|
|
|
| 76 |
--data.cache_dir uk_UA-ASMR/cache \
|
| 77 |
--data.config_path uk_UA-ASMR/output/uk_UA-asmr-medium.onnx.json \
|
| 78 |
--data.batch_size 32 \
|
| 79 |
-
--model.vocoder_warmstart_ckpt uk_UA-ASMR/checkpoints/
|
| 80 |
--trainer.max_epochs 500 \
|
| 81 |
-
--trainer.check_val_every_n_epoch 1
|
|
|
|
| 82 |
```
|
| 83 |
|
|
|
|
|
|
|
| 84 |
#### Continue from latest checkpoint
|
| 85 |
|
| 86 |
```bash
|
| 87 |
python3 -m piper.train fit \
|
| 88 |
--data.voice_name "uk_asmr" \
|
| 89 |
-
--data.csv_path uk_UA-ASMR/
|
| 90 |
--data.audio_dir uk_UA-ASMR/audio \
|
| 91 |
--data.espeak_voice "uk" \
|
| 92 |
--model.sample_rate 22050 \
|
| 93 |
--data.phoneme_type "text" \
|
| 94 |
-
--data.dataset_type "
|
|
|
|
| 95 |
--data.cache_dir uk_UA-ASMR/cache \
|
| 96 |
--data.config_path uk_UA-ASMR/output/uk_UA-asmr-medium.onnx.json \
|
| 97 |
--data.batch_size 32 \
|
| 98 |
-
--model.vocoder_warmstart_ckpt uk_UA-ASMR/checkpoints/
|
| 99 |
--trainer.max_epochs 500 \
|
| 100 |
--trainer.check_val_every_n_epoch 1 \
|
| 101 |
-
--
|
|
|
|
| 102 |
```
|
| 103 |
|
|
|
|
|
|
|
| 104 |
### Exporting
|
| 105 |
|
| 106 |
```bash
|
|
|
|
| 107 |
python3 -m piper.train.export_onnx \
|
| 108 |
-
--checkpoint lightning_logs/version_0/checkpoints/
|
| 109 |
--output-file uk_UA-ASMR/output/uk_UA-asmr-medium.onnx
|
| 110 |
```
|
| 111 |
|
|
@@ -125,10 +156,10 @@ After training and export, you will have:
|
|
| 125 |
pip install piper-tts
|
| 126 |
|
| 127 |
# Generate speech
|
| 128 |
-
|
|
|
|
| 129 |
--model uk_UA-ASMR/output/uk_UA-asmr-medium.onnx \
|
| 130 |
-
--
|
| 131 |
-
--text "Привіт, як справи?"
|
| 132 |
```
|
| 133 |
|
| 134 |
## Phoneme Type
|
|
|
|
| 28 |
|
| 29 |
## Dataset Structure
|
| 30 |
|
| 31 |
+
```bash
|
| 32 |
+
# 1. Download the dataset
|
| 33 |
+
hf download kontextox/uk_UA-ASMR --repo-type dataset
|
| 34 |
+
unzip -q uk_UA-ASMR/audio.zip -d uk_UA-ASMR
|
| 35 |
+
|
| 36 |
+
# 2. Download the base checkpoint AND its configuration
|
| 37 |
+
hf download rhasspy/piper-checkpoints uk/uk_UA/ukrainian_tts/medium/epoch=2090-step=1166778.ckpt \
|
| 38 |
+
--repo-type dataset --local-dir uk_UA-ASMR/checkpoints
|
| 39 |
+
|
| 40 |
+
hf download rhasspy/piper-checkpoints uk/uk_UA/ukrainian_tts/medium/config.json \
|
| 41 |
+
--repo-type dataset --local-dir uk_UA-ASMR/checkpoints
|
| 42 |
+
|
| 43 |
+
# 3. Extract the exact phoneme map from the base config to use for training
|
| 44 |
+
python3 -c "import json; json.dump(json.load(open('uk_UA-ASMR/checkpoints/config.json'))['phoneme_id_map'], open('uk_UA-ASMR/phonemes.json', 'w'))"
|
| 45 |
```
|
| 46 |
+
|
| 47 |
+
```text
|
| 48 |
+
uk_UA-ASMR/
|
| 49 |
├── README.md
|
| 50 |
├── metadata.csv # Metadata
|
| 51 |
+
├── phonemes.json # Automatically extracted Ukrainian phoneme map
|
| 52 |
├── audio/ # Audio files (22050 Hz, mono, 16-bit)
|
| 53 |
│ ├── utt_0001.wav
|
| 54 |
│ ├── utt_0002.wav
|
| 55 |
│ └── ...
|
| 56 |
+
└── checkpoints/
|
| 57 |
+
├── config.json
|
| 58 |
└── epoch=2090-step=1166778.ckpt
|
| 59 |
```
|
| 60 |
|
|
|
|
| 78 |
python3 -m pip install -e '.[train]'
|
| 79 |
./build_monotonic_align.sh
|
| 80 |
python3 setup.py build_ext --inplace
|
| 81 |
+
|
| 82 |
+
# CRITICAL FIX for custom text phonemes in Piper:
|
| 83 |
+
# This patches dataset.py to properly use the custom phoneme map loaded via --data.phonemes_path
|
| 84 |
+
sed -i 's/phonemes_to_ids(sentence_phonemes)/phonemes_to_ids(sentence_phonemes, id_map=self.piper_config.phoneme_id_map)/g' src/piper/train/vits/dataset.py
|
| 85 |
```
|
| 86 |
|
| 87 |
### Training Command
|
|
|
|
| 89 |
```bash
|
| 90 |
python3 -m piper.train fit \
|
| 91 |
--data.voice_name "uk_asmr" \
|
| 92 |
+
--data.csv_path uk_UA-ASMR/metadata.csv \
|
| 93 |
--data.audio_dir uk_UA-ASMR/audio \
|
| 94 |
--data.espeak_voice "uk" \
|
| 95 |
--model.sample_rate 22050 \
|
| 96 |
--data.phoneme_type "text" \
|
| 97 |
+
--data.dataset_type "text" \
|
| 98 |
+
--data.phonemes_path uk_UA-ASMR/phonemes.json \
|
| 99 |
--data.cache_dir uk_UA-ASMR/cache \
|
| 100 |
--data.config_path uk_UA-ASMR/output/uk_UA-asmr-medium.onnx.json \
|
| 101 |
--data.batch_size 32 \
|
| 102 |
+
--model.vocoder_warmstart_ckpt uk_UA-ASMR/checkpoints/epoch=2090-step=1166778.ckpt \
|
| 103 |
--trainer.max_epochs 500 \
|
| 104 |
+
--trainer.check_val_every_n_epoch 1 \
|
| 105 |
+
--trainer.default_root_dir uk_UA-ASMR/output
|
| 106 |
```
|
| 107 |
|
| 108 |
+
_(Note: `--trainer.default_root_dir` ensures PyTorch Lightning saves logs and checkpoints cleanly to `uk_UA-ASMR/output/lightning_logs/`)_
|
| 109 |
+
|
| 110 |
#### Continue from latest checkpoint
|
| 111 |
|
| 112 |
```bash
|
| 113 |
python3 -m piper.train fit \
|
| 114 |
--data.voice_name "uk_asmr" \
|
| 115 |
+
--data.csv_path uk_UA-ASMR/metadata.csv \
|
| 116 |
--data.audio_dir uk_UA-ASMR/audio \
|
| 117 |
--data.espeak_voice "uk" \
|
| 118 |
--model.sample_rate 22050 \
|
| 119 |
--data.phoneme_type "text" \
|
| 120 |
+
--data.dataset_type "text" \
|
| 121 |
+
--data.phonemes_path uk_UA-ASMR/phonemes.json \
|
| 122 |
--data.cache_dir uk_UA-ASMR/cache \
|
| 123 |
--data.config_path uk_UA-ASMR/output/uk_UA-asmr-medium.onnx.json \
|
| 124 |
--data.batch_size 32 \
|
| 125 |
+
--model.vocoder_warmstart_ckpt uk_UA-ASMR/checkpoints/epoch=2090-step=1166778.ckpt \
|
| 126 |
--trainer.max_epochs 500 \
|
| 127 |
--trainer.check_val_every_n_epoch 1 \
|
| 128 |
+
--trainer.default_root_dir uk_UA-ASMR/output \
|
| 129 |
+
--ckpt_path uk_UA-ASMR/output/lightning_logs/version_0/checkpoints/last.ckpt
|
| 130 |
```
|
| 131 |
|
| 132 |
+
_(Check your `lightning_logs` folder for the exact `.ckpt` filename)_
|
| 133 |
+
|
| 134 |
### Exporting
|
| 135 |
|
| 136 |
```bash
|
| 137 |
+
# 1. Export the ONNX model from your best/latest checkpoint
|
| 138 |
python3 -m piper.train.export_onnx \
|
| 139 |
+
--checkpoint uk_UA-ASMR/output/lightning_logs/version_0/checkpoints/epoch=14-step=6180.ckpt \
|
| 140 |
--output-file uk_UA-ASMR/output/uk_UA-asmr-medium.onnx
|
| 141 |
```
|
| 142 |
|
|
|
|
| 156 |
pip install piper-tts
|
| 157 |
|
| 158 |
# Generate speech
|
| 159 |
+
# (Pipe the text using 'echo' to avoid CLI parsing errors with raw text modes)
|
| 160 |
+
echo "привіт, як справи?" | python3 -m piper \
|
| 161 |
--model uk_UA-ASMR/output/uk_UA-asmr-medium.onnx \
|
| 162 |
+
--output_file audio.wav
|
|
|
|
| 163 |
```
|
| 164 |
|
| 165 |
## Phoneme Type
|
metadata.csv
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|