File size: 1,484 Bytes
5ba200a
 
 
75c7813
 
 
 
5ba200a
 
 
75c7813
5ba200a
 
9f2178c
 
5ba200a
 
 
 
 
 
 
 
 
 
 
 
 
 
ea00306
f1d913a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
license: mit
language:
- ar
- cs
- de
- el
- en
- id
- hi
- fa
- fr
- ne
- nl
- no
- sw
- sr
- zh
- vi
- tr
- uk
- ru
- ro
- pt
- pl
- nl
- hu
- es
- cs
pipeline_tag: text-to-speech
---
## Guidelines for Converting Piper ONNX Model

**References:**
* https://github.com/nihui/ncnn-android-piper
* https://github.com/OHF-Voice/piper1-gpl
* https://huggingface.co/datasets/rhasspy/piper-checkpoints

**Steps to convert Piper checkpoints to NCNN models:**

1.  **Checkout the correct version of the piper repository:**
    ```bash
    git clone [https://github.com/OHF-Voice/piper1-gpl](https://github.com/OHF-Voice/piper1-gpl)
    cd piper1-gpl
    git checkout 113931937cf235fc8all1afd1ca4be209bc6919bc7
    ```

2.  **Apply the necessary patch:**
    ```bash
    # Ensure 'piper1-gpl.patch' is available
    git apply piper1-gpl.patch
    ```

3.  **Set up the Python environment and install dependencies:**
    ```bash
    python3 -m venv .venv
    source .venv/bin/activate
    python3 -m pip install -e .[train]
    ```

4.  **Download a Piper checkpoint file (`.ckpt`) from Hugging Face:**
    https://huggingface.co/datasets/rhasspy/piper-checkpoints

5.  **Install the PNNX model converter:**
    ```bash
    pip install -U pnnx
    ```

6.  **Obtain the `export_ncnn.py` script.**

7.  **Run the conversion script on your checkpoint file:**
    ```bash
    # Replace with your actual file
    python export_ncnn.py (language code).ckpt (e.g., en.ckpt, fa.ckpt, ...)
    ```