File size: 871 Bytes
8d0d264
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/sh
# VoxCPM2 on AX8860, llama.cpp + ggml-axera.
#   ./run.sh <text> [out.wav] [reference.wav] [reference_text]
# reference.wav is optional; without it the default preset voice is used.
# reference_text enables continuation-style zero-shot cloning when supplied.
H=$(cd "$(dirname "$0")" && pwd)
[ $# -ge 1 ] || { sed -n 2,6p "$0"; exit 2; }

text=$1
out=${2:-out.wav}
ref=${3:-}
reftext=${4:-}

export LD_LIBRARY_PATH=/opt/lib
export GGML_AXERA_KERNEL_DIR=$H/kernels

base=$H/gguf/VoxCPM2-BaseLM-F16.gguf
acoustic=$H/gguf/VoxCPM2-Acoustic-F16.gguf

set -- "$H/bin/llama-tts" \
    --voxcpm2-base-lm "$base" \
    --voxcpm2-acoustic "$acoustic" \
    -ngl 99 -c 8192 -n 200 \
    -p "$text" -o "$out"

if [ -n "$ref" ]; then
    set -- "$@" --tts-speaker-file "$ref"
    if [ -n "$reftext" ]; then
        set -- "$@" --tts-ref-text "$reftext"
    fi
fi

exec "$@"