
Viettts เป็นชุดเครื่องมือโอเพนซอร์ซที่ให้ชุมชนด้วยโมเดล TTS เวียดนามที่ทรงพลังซึ่งสามารถสังเคราะห์เสียงธรรมชาติและการโคลนนิ่งเสียงที่แข็งแกร่ง ออกแบบมาเพื่อการทดลองที่มีประสิทธิภาพ Viettts สนับสนุนการวิจัยและการประยุกต์ใช้ในเทคโนโลยีเสียงเวียดนาม
Viettts สามารถติดตั้งผ่านตัวติดตั้ง Python (Linux เท่านั้นโดยมีการสนับสนุน Windows และ MacOS เร็ว ๆ นี้) หรือ 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 purgeติดตั้ง Docker, Nvidia Driver, Nvidia Container Tooler และ Cuda
เรียกใช้คำสั่งต่อไปนี้:
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 8298คุณสามารถใช้เสียงที่มีอยู่เพื่อสังเคราะห์คำพูด
| รหัสประจำตัว | เสียง | เพศ | เล่นเสียง |
|---|---|---|---|
| 1 | nsnd-le-chuc | - | |
| 2 | sputchify_10 | - | |
| 3 | atuan | - | |
| 4 | พูด _11 | - | |
| 5 | CDTEAM | - | |
| 6 | พูด _12 | - | |
| 7 | cross_lingual_prompt | - | |
| 8 | พูด _2 | - | |
| 9 | diep-chi | - | |
| 10 | พูด _3 | - | |
| 11 | Doremon | - | |
| 12 | sputchify_4 | - | |
| 13 | แจ็คสปาร์โรว์ | - | |
| 14 | คำพูด _5 | - | |
| 15 | Nguyen-ngoc-ngan | - | |
| 16 | คำพูด _6 | - | |
| 17 | Nu-nhe-nhang | - | |
| 18 | คำพูด _7 | - | |
| 19 | คินห์ | - | |
| 20 | พูด _8 | - | |
| 21 | พูด _9 | - | |
| 22 | Son-Tung-MTP | - | |
| 23 | zero_shot_prompt | - | |
| 24 | พูด _1 | - |
อินเทอร์เฟซบรรทัดคำสั่ง Viettts (CLI) ช่วยให้คุณสามารถสร้างคำพูดได้อย่างรวดเร็วจากเทอร์มินัล นี่คือวิธีการใช้งาน:
# 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.wavคุณต้องตั้งค่าตัวแปรสภาพแวดล้อมสำหรับไคลเอนต์ OpenAI:
# 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 versionเพื่อสร้างคำพูดจากข้อความอินพุต:
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 ( ) ; ซอร์สโค้ด Viettts ถูกเผยแพร่ภายใต้ ใบอนุญาต Apache 2.0 โมเดลที่ผ่านการฝึกอบรมมาก่อนและตัวอย่างเสียงได้รับใบอนุญาตภายใต้ ใบอนุญาต CC BY-NC โดยใช้ชุดข้อมูลในวงการ ขออภัยในความไม่สะดวกที่อาจเกิดขึ้น
เนื้อหาที่ให้ไว้ข้างต้นมีวัตถุประสงค์เพื่อการศึกษาเท่านั้นและมีวัตถุประสงค์เพื่อแสดงให้เห็นถึงความสามารถทางเทคนิค ตัวอย่างบางส่วนมาจากอินเทอร์เน็ต หากเนื้อหาใด ๆ ที่ละเมิดสิทธิ์ของคุณโปรดติดต่อเราเพื่อขอการลบออก