Cài đặt Supertonic-3 bằng Conda
Giới thiệu
Supertonic là một hệ thống chuyển văn bản thành giọng nói đa ngôn ngữ cực nhanh, hoạt động trên thiết bị, được thiết kế để suy luận cục bộ với chi phí tối thiểu. Được hỗ trợ bởi ONNX Runtime, nó chạy hoàn toàn trên thiết bị của bạn—không cần đám mây, không cần gọi API, không lo ngại về quyền riêng tư.
GitHub: https://github.com/supertone-inc/supertonic
Hugging Face: https://hf.co/Supertone/supertonic-3
Paper: https://hf.co/papers/2410.06885
Demo: https://hf.co/spaces/Supertone/supertonic-3
Audio Samples: https://supertonic3.github.io
Available Voices: https://supertone-inc.github.io/supertonic-py/voices/
Ngôn ngữ
🌍 31 ngôn ngữ được hỗ trợ:
Arabic (ar), Bulgarian (bg), Croatian (hr), Czech (cs), Danish (da), Dutch (nl), English (en), Estonian (et), Finnish (fi), French (fr), German (de), Greek (el), Hindi (hi), Hungarian (hu), Indonesian (id), Italian (it), Japanese (ja), Korean (ko), Latvian (lv), Lithuanian (lt), Polish (pl), Portuguese (pt), Romanian (ro), Russian (ru), Slovak (sk), Slovenian (sl), Spanish (es), Swedish (sv), Turkish (tr), Ukrainian (uk), Vietnamese (vi)
Không chắc văn bản của bạn thuộc ngôn ngữ nào? Hãy truyền
lang="na"và Supertonic sẽ xử lý đầu vào theo cách không phụ thuộc vào ngôn ngữ — không cần thẻ ngôn ngữ cụ thể.
Yêu cầu hệ thống
- Hệ điều hành: Windows 10/11 (64-bit), macOS hoặc Linux (Debian/Ubuntu).
- Python: Yêu cầu phiên bản >= 3.10
- Dung lượng ổ cứng: Khuyến nghị 10GB trở lên (cho các thư viện phụ thuộc và bộ nhớ cache mô hình). Ít nhất 400 MB cho Miniconda; 3 GB trở lên cho Anaconda đầy đủ.
- GPU: là tùy chọn nhưng RẤT KHUYÊN DÙNG để tăng hiệu suất.
- Internet: Để tải xuống các thư viện phụ thuộc và mô hình từ Hugging Face Hub.
| Mức yêu cầu | CPU | RAM |
|---|---|---|
| Tối thiểu | Intel Core i3 hoặc AMD Ryzen 3 | 8 GB |
| Khuyến nghị | Intel Core i5 hoặc AMD Ryzen 5 | 16 GB |
| Hiệu năng cao | Intel Core i7/i9 hoặc AMD Ryzen 7/9 | 32 GB |
| Môi trường | Chạy lệnh để cài đặt | Kiến trúc |
|---|---|---|
| CPU only | pip3 install torch torchvision |
IA-32 and Intel 64 |
| Apple Silicon | pip3 install torch torchvision |
|
| AMD ROCm | Install PyTorch for ROCm | |
| CUDA 11.8 | pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 |
Kepler/Maxwell → Ada Lovelace, Hopper |
| CUDA 12.1 | pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 |
Kepler/Maxwell → Ada Lovelace, Hopper |
| CUDA 12.4 | pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124 |
Kepler/Maxwell → Ada Lovelace, Hopper |
| CUDA 12.6 | pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126 |
Maxwell → Hopper |
| CUDA 12.8 | pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128 |
Volta → Blackwell |
| CUDA 12.9 | pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu129 |
Volta → Blackwell |
| CUDA 13.0 | pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu130 |
Turing → Blackwell |
| CUDA 13.2 | pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu132 |
Turing → Blackwell |
| CUDA 13.4 | pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu134 |
Turing → Blackwell |
Các phiên bản PyTorch khả dụng:
pip index versions torch
pip index versions torchaudio
pip index versions torchvision
pip index versions torch --index-url https://download.pytorch.org/whl/cu118
pip index versions torchaudio --index-url https://download.pytorch.org/whl/cu118
pip index versions torchvision --index-url https://download.pytorch.org/whl/cu118| Môi trường | 2.15.0 | 2.14.1 | 2.14.0 | 2.13.0 | 2.12.1 | 2.12.0 | 2.11.0 | 2.10.0 | 2.9.1 | 2.9.0 | 2.8.0 | 2.7.1 | 2.7.0 | 2.6.0 | 2.5.1 | 2.5.0 | 2.4.1 | 2.4.0 | 2.3.1 | 2.3.0 | 2.2.2 | 2.2.1 | 2.2.0 | 2.1.2 | 2.1.1 | 2.1.0 | 2.0.1 | 2.0.0 | 1.13.1 | 1.13.0 | 1.12.1 | 1.12.0 | 1.11.0 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cpu | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| cu118 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ||||||||||||||||
| cu121 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |||||||||||||||||||||
| cu124 | ✅ | ✅ | ✅ | ✅ | ✅ | ||||||||||||||||||||||||||||
| cu126 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ||||||||||||||||||||
| cu128 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ||||||||||||||||||||||||||
| cu129 | ✅ | ✅ | |||||||||||||||||||||||||||||||
| cu130 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ||||||||||||||||||||||||
| cu132 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |||||||||||||||||||||||||||
| cu134 | ✅ |
Video hướng dẫn
Bước 1. Cài đặt Miniconda
Tải xuống Miniconda: https://www.anaconda.com/download/success?reg=skipped
Liên kết trực tiếp: https://anaconda.com/api/installers/Miniconda3-latest-Windows-x86_64.exe
Liên kết trực tiếp: https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-arm64.exe
Cài đặt Miniconda trên Windows
Bước 2. Tạo môi trường Conda
Tạo tệp environment.yml:
name: supertonic
channels:
- conda-forge
- defaults
dependencies:
# Python version >= 3.10 required
- python=3.10
- pip
- pip:
# Supertonic TTS
- supertonic
# Local HTTP Server
- supertonic[serve]Kích hoạt môi trường conda:
conda env create -f environment.yml
conda activate supertonicBước 3. Tạo một tệp Python
Tạo một tệp có tên supertonic_tts_test.py:
from supertonic import TTS
# First run downloads the model from Hugging Face automatically.
tts = TTS(auto_download=True)
style = tts.get_voice_style(voice_name="M1")
text = "Supertonic is a lightning fast, on-device TTS system."
wav, duration = tts.synthesize(
text=text,
lang="en", # Language code (e.g., "en", "ko", "na" for language-agnostic)
voice_style=style, # Voice style object
total_steps=8, # Quality: 5 (low) to 12 (high), default 8 (medium)
speed=1.05, # Speed: 0.7 (slow) to 2.0 (fast)
)
# wav: numpy array of shape (1, num_samples,) with dtype=np.float32, sampled at 44100 Hz
# duration: numpy array of shape (1,) containing the duration of the generated audio in seconds
tts.save_audio(wav, "output.wav")
# import soundfile as sf
# sf.write("output.wav", wav.squeeze(), 44100)
print(f"Generated {duration[0]:.2f}s of audio")Chạy thử:
python supertonic_tts_test.pyKết quả sẽ là tệp âm thanh output.wav
Máy chủ HTTP cục bộ
Bộ SDK Python cũng có thể chạy Supertonic như một dịch vụ HTTP cục bộ. Điều này hữu ích khi bạn muốn gọi Supertonic từ các công cụ đã hỗ trợ HTTP, chẳng hạn như các tác nhân cục bộ, tiện ích mở rộng trình duyệt, ứng dụng Electron, công cụ tự động hóa quy trình làm việc hoặc các máy khách âm thanh tương thích với OpenAI.
supertonic serve --host 127.0.0.1 --port 7788Sau khi khởi chạy, hãy sử dụng điểm cuối POST /v1/tts gốc hoặc điểm cuối POST /v1/audio/speech tương thích với OpenAI. Máy chủ cũng cung cấp tài liệu OpenAPI tương tác tại http://127.0.0.1:7788/docs. Xem hướng dẫn supertonic-py serve để biết các ví dụ về yêu cầu, tổng hợp hàng loạt và nhập JSON tùy chỉnh của Voice Builder.


