g
gcw_AVRCax4T/chat-daiyu-sovits
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

chat-daiyu-sovits (Ascend NPU Adaptation)

Model Introduction

chat-daiyu-sovits is a GPT-SoVITS S1 autoregressive (AR) model fine-tuned for Daiyu voice cloning. This repository contains the Ascend NPU adaptation that enables high-performance inference on Huawei Ascend 910 hardware.

  • Model Architecture: GPT-SoVITS S1 AR (24-layer Transformer)
  • Parameters: 77,494,787
  • Original Model: Omelette/chat-daiyu-sovits
  • Task: Text-to-Semantic-Token (S1 stage of GPT-SoVITS pipeline)
  • Language: Chinese (zh-CN)
  • Adaptation Target: Ascend 910 NPU (CANN 8.5.1, torch_npu 2.9.0)

Quick Start

Environment Requirements

ComponentVersion
CANN8.5.1
torch2.9.0
torch_npu2.9.0.post1
Python3.11
Ascend NPU910

Model Download

pip install modelscope
modelscope download --model Omelette/chat-daiyu-sovits --local_dir ./chat-daiyu-sovits

Inference

# Precision evaluation (CPU vs NPU)
python inference.py --mode eval --checkpoint ./chat-daiyu-sovits/daiyu-voice-e12.ckpt

# Performance benchmark
python inference.py --mode benchmark --checkpoint ./chat-daiyu-sovits/daiyu-voice-e12.ckpt

# Single inference demo
python inference.py --mode inference --checkpoint ./chat-daiyu-sovits/daiyu-voice-e12.ckpt

Python API

import torch
from inference import ARModel, build_model_from_checkpoint

# Load model on NPU
model, config = build_model_from_checkpoint(
    "./chat-daiyu-sovits/daiyu-voice-e12.ckpt",
    device="npu:0"
)

# Prepare inputs
bert_features = torch.randn(1, 15, 1024, device="npu:0")  # BERT semantic features
text_tokens = torch.randint(0, 512, (1, 8), device="npu:0")  # Text phoneme tokens

# Generate audio tokens
audio_tokens = model.generate(bert_features, text_tokens, max_new_tokens=100, top_k=5)
print(f"Generated {audio_tokens.shape[1]} audio tokens")

Precision Evaluation

NPU inference precision is validated against CPU (float32) baseline with the following results:

MetricResultThresholdStatus
Forward Relative Error0.073%< 1%PASS
Cosine Similarity1.0000001> 0.9999PASS
Top-1 Accuracy100.0%> 99%PASS
Top-5 Accuracy100.0%> 99%PASS
Top-10 Accuracy100.0%> 99%PASS
Greedy Generation Match100.0%> 98%PASS
Overall PrecisionPASS-PASS

Layer-by-Layer Precision

LayerMax Absolute Diff
Embedding (Layer 0)1.53e-05
Layer 12 (Mid)0.055
Output (Layer 24)0.041

Performance Benchmark

Environment: Ascend 910 NPU x2, CANN 8.5.1

Forward Pass

MetricNPUCPUSpeedup
Average Latency9.57 ms244.35 ms25.5x
Std Dev0.10 ms--
Throughput208.9 samples/s8.2 samples/s25.5x

Autoregressive Generation

MetricValue
Avg Generation Time (50 tokens)0.41 s
Token Generation Rate21.8 tokens/s

Memory Usage

TypeUsage
Allocated310.9 MB
Reserved328.0 MB

Model Architecture Details

GPT-SoVITS S1 AR Model (77.5M parameters)
├── BERT Projection: Linear(1024 → 512)
├── Text Embedding: Embedding(512 × 512)
├── Audio Embedding: Embedding(1025 × 512)
├── Sine Positional Encoding (x2, with learnable alpha)
├── Transformer Layers ×24
│   ├── Self-Attention (16 heads, head_dim=32)
│   ├── FFN (Linear 512→2048, GELU, 2048→512)
│   └── Pre-LayerNorm
└── Output Head: Linear(512 → 1025)

Directory Structure

chat-daiyu-sovits-npu/
├── inference.py          # NPU inference script
├── eval_results.json     # Precision & performance results
├── run_eval.log         # Evaluation run log
└── README.md            # This document

Known Issues

  • Warning messages: Non-critical permission/ownership warnings from torch_npu are expected in the current CANN environment. They do not affect functionality or precision.
  • Top-K sampling randomness: When using top_k > 0, small floating-point differences between NPU and CPU may lead to different sampling paths. Use top_k=0 (greedy) for deterministic output comparison.

License

This adaptation is released under Apache License 2.0, consistent with the original model license.

Citation

@misc{chat-daiyu-sovits-npu,
  title = {chat-daiyu-sovits Ascend NPU Adaptation},
  author = {Ascend NPU Adaptation},
  year = {2026},
  url = {https://modelscope.cn/Omelette/chat-daiyu-sovits},
}