
Viettts es un kit de herramientas de código abierto que proporciona a la comunidad un poderoso modelo TTS vietnamita, capaz de síntesis de voz natural y clonación de voz robusta. Diseñado para una experimentación efectiva, Viettts apoya la investigación y la aplicación en tecnologías de voz vietnamitas.
Viettts se puede instalar a través de un instalador de Python (solo con Windows y MacOS admite pronto) o Docker.
git clone https://github.com/dangvansam/viet-tts.git
cd viet-tts
# (Optional) Install Python environment with conda, you could also use virtualenv
conda create --name viettts python=3.10
conda activate viettts
# Install
pip install -e . && pip cache purgeInstale Docker, controlador NVIDIA, kit de herramientas de contenedores NVIDIA y CUDA.
Ejecute los siguientes comandos:
git clone https://github.com/dangvansam/viet-tts.git
cd viet-tts
# Build docker images
docker compose build
# Run with docker-compose - will create server at: http://localhost:8298
docker compose up -d
# Or run with docker run - will create server at: http://localhost:8298
docker run -itd --gpu=alls -p 8298:8298 -v ./pretrained-models:/app/pretrained-models -n viet-tts-service viet-tts:latest viettts server --host 0.0.0.0 --port 8298Puede usar voces disponibles a continuación para sintetizar el habla.
| IDENTIFICACIÓN | Voz | Género | Reproducir audio |
|---|---|---|---|
| 1 | nsnd-le-chuc | ? | |
| 2 | Speakify_10 | ? | |
| 3 | atuan | ? | |
| 4 | Speakify_11 | ? | |
| 5 | CDTEAM | ? | |
| 6 | Speakify_12 | ? | |
| 7 | cross_lingual_prompt | ? | |
| 8 | Speakify_2 | ? | |
| 9 | chi-chi | ? | |
| 10 | Speakify_3 | ? | |
| 11 | doremón | ? | |
| 12 | Speakify_4 | ? | |
| 13 | giro de gato | ? | |
| 14 | Speakify_5 | ? | |
| 15 | nguyen-ngoc-ngan | ? | |
| 16 | Speakify_6 | ? | |
| 17 | nu-nhe-nhang | ? | |
| 18 | Speakify_7 | ? | |
| 19 | quynh | ? | |
| 20 | Speakify_8 | ? | |
| 21 | Speakify_9 | ? | |
| 22 | hijo-tung-mtp | ? | |
| 23 | cero_shot_prompt | ? | |
| 24 | Speakify_1 | ? |
La interfaz de línea de comandos Viettts (CLI) le permite generar rápidamente el habla directamente desde el terminal. Aquí le mostramos cómo usarlo:
# Usage
viettts --help
# Start API Server
viettts server --host 0.0.0.0 --port 8298
# List all built-in voices
viettts show-voices
# Synthesize speech from text with built-in voices
viettts synthesis --text " Xin chào " --voice 0 --output test.wav
# Clone voice from a local audio file
viettts synthesis --text " Xin chào " --voice Download/voice.wav --output cloned.wavNecesita establecer variables de entorno para el cliente Operai:
# Set base_url and API key as environment variables
export OPENAI_BASE_URL=http://localhost:8298
export OPENAI_API_KEY=viet-tts # not use in current versionPara crear discurso a partir del texto de entrada:
from pathlib import Path
from openai import OpenAI
client = OpenAI ()
output_file_path = Path ( __file__ ). parent / "speech.wav"
with client . audio . speech . with_streaming_response . create (
model = 'tts-1' ,
voice = 'cdteam' ,
input = 'Xin chào Việt Nam.' ,
speed = 1.0 ,
response_format = 'wav'
) as response :
response . stream_to_file ( 'a.wav' ) # Get all built-in voices
curl --location http://0.0.0.0:8298/v1/voices
# OpenAI format (bult-in voices)
curl http://localhost:8298/v1/audio/speech
-H " Authorization: Bearer viet-tts "
-H " Content-Type: application/json "
-d ' {
"model": "tts-1",
"input": "Xin chào Việt Nam.",
"voice": "son-tung-mtp"
} '
--output speech.wav
# API with voice from local file
curl --location http://0.0.0.0:8298/v1/tts
--form ' text="xin chào" '
--form ' audio_file=@"/home/viettts/Downloads/voice.mp4" '
--output speech.wav import fs from "fs" ;
import path from "path" ;
import OpenAI from "openai" ;
const openai = new OpenAI ( ) ;
const speechFile = path . resolve ( "./speech.wav" ) ;
async function main ( ) {
const mp3 = await openai . audio . speech . create ( {
model : "tts-1" ,
voice : "1" ,
input : "Xin chào Việt Nam." ,
} ) ;
console . log ( speechFile ) ;
const buffer = Buffer . from ( await mp3 . arrayBuffer ( ) ) ;
await fs . promises . writeFile ( speechFile , buffer ) ;
}
main ( ) ; El código fuente de Viettts se publica bajo la licencia Apache 2.0 . Los modelos previamente capacitados y las muestras de audio tienen licencia bajo la licencia CC BY-NC , basada en un conjunto de datos en el flujo. Pedimos disculpas por cualquier inconveniente que esto pueda causar.
El contenido proporcionado anteriormente es solo para fines académicos y está destinado a demostrar capacidades técnicas. Algunos ejemplos se obtienen de Internet. Si algún contenido infringe sus derechos, contáctenos para solicitar su eliminación.