Cài đặt Nari Dia bằng Conda
Giới thiệu
Dia là một mô hình chuyển văn bản thành giọng nói với 1,6 tỷ tham số được tạo ra bởi Nari Labs. Dia có khả năng tạo ra các đoạn hội thoại cực kỳ chân thực chỉ trong một lần xử lý.
GitHub: https://github.com/nari-labs/dia
Hugging Face: https://hf.co/nari-labs/Dia-1.6B-0626
Demo: https://hf.co/spaces/nari-labs/Dia-1.6B
Example: https://yummy-fir-7a4.notion.site/dia
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: dia
channels:
- conda-forge
- defaults
dependencies:
# Python version (requires >= 3.10)
- python=3.10
- pip
- pip:
# PyTorch CPU only
- torch
- torchaudio
# Nari TTS Install Dia directly from GitHub.
- git+https://github.com/nari-labs/dia.gitKích hoạt môi trường conda:
conda env create -f environment.yml
conda activate diaClone và cài Dia từ source (chạy sau khi kích hoạt môi trường)
git clone https://github.com/nari-labs/dia.git
cd diaBước 3. Chạy suy luận
Bây giờ, hãy chạy thử một vài ví dụ.
python example/simple.pygenerate: starting generation loop
generate step 86: speed=1.168 tokens/s, realtime factor=0.014x
generate step 172: speed=1.192 tokens/s, realtime factor=0.014x
generate step 258: speed=1.221 tokens/s, realtime factor=0.014x
generate step 344: speed=1.141 tokens/s, realtime factor=0.013x
generate step 430: speed=1.156 tokens/s, realtime factor=0.013x
generate step 516: speed=1.067 tokens/s, realtime factor=0.012x
generate step 602: speed=1.092 tokens/s, realtime factor=0.013x
generate step 688: speed=1.112 tokens/s, realtime factor=0.013x
generate step 774: speed=1.113 tokens/s, realtime factor=0.013x
generate: avg steps=831.0, total duration=751.395sKết quả sẽ là tệp âm thanh simple.mp3
Khởi chạy Giao diện Web (Gradio Web UI)
Sau khi cài đặt xong, bạn không cần viết code mà có thể bật ngay một giao diện Web UI cục bộ bằng lệnh:
python app.pyMở trình duyệt và truy cập vào địa chỉ http://127.0.0.1:7860 để bắt đầu sử dụng. Hệ thống sẽ tự động tải các file Model (Trọng số cấu hình mã nguồn) từ HuggingFace trong lần đầu chạy.


