
Viettts هي مجموعة أدوات مفتوحة المصدر توفر للمجتمع نموذج TTS فيتنامي قوي ، قادر على توليف الصوت الطبيعي واستنساخ الصوت القوي. تم تصميم VIETTS للبحث والتطبيق في تقنيات الصوت الفيتنامية.
يمكن تثبيت 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 Toolkit و 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 | خطاب _10 | ؟ | |
| 3 | أتوان | ؟ | |
| 4 | Preeberkify_11 | ؟ | |
| 5 | cdteam | ؟ | |
| 6 | خطاب _12 | ؟ | |
| 7 | cross_lingual_prompt | ؟ | |
| 8 | Preebeor_2 | ؟ | |
| 9 | DIEP-chi | ؟ | |
| 10 | Preeberkify_3 | ؟ | |
| 11 | دوروون | ؟ | |
| 12 | خطاب _4 | ؟ | |
| 13 | جاك سبارو | ؟ | |
| 14 | خطاب _5 | ؟ | |
| 15 | نغوين نغوك نانغان | ؟ | |
| 16 | خطاب _6 | ؟ | |
| 17 | نو نهانغ | ؟ | |
| 18 | خطاب _7 | ؟ | |
| 19 | Quynh | ؟ | |
| 20 | Preeberkify_8 | ؟ | |
| 21 | خطاب _9 | ؟ | |
| 22 | الابن تونغ 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 ، استنادًا إلى مجموعة بيانات داخل الولادة. نعتذر عن أي إزعاج قد يسببه هذا.
المحتوى الوارد أعلاه هو لأغراض أكاديمية فقط ويهدف إلى إظهار القدرات الفنية. يتم الحصول على بعض الأمثلة من الإنترنت. إذا كان أي محتوى ينتهك حقوقك ، فيرجى الاتصال بنا لطلب إزالته.