GPA (General Purpose Audio) is a unified autoregressive transformer that combines three core speech tasks — Automatic Speech Recognition (ASR), Text-to-Speech (TTS), and Voice Conversion (VC) — into a single 0.31B parameter model based on the Qwen3 architecture. This repository provides the model adapted for Huawei Ascend 910 NPU.
| Attribute | Value |
|---|---|
| Parameters | 0.31B |
| Architecture | Qwen3ForCausalLM |
| Layers | 28 (full attention) |
| Hidden Size | 512 |
| Intermediate Size | 3072 |
| Attention Heads | 16 (8 KV heads, GQA) |
| Vocab Size | 180,445 |
| Max Position Embeddings | 32,768 |
| Precision (inference) | float32 / bfloat16 |
| Language | en, zh |
| Component | Version/Model |
|---|---|
| NPU | Ascend 910 (2 cards) |
| CANN | 8.5.1 |
| torch | 2.9.0 |
| torch_npu | 2.9.0.post1 |
| transformers | 4.57.6 |
| Python | 3.11.14 |
model.to(torch.device("npu:0")) using torch_npuAutoModelForCausalLM.from_pretrained() with trust_remote_code=Truemodeling_qwen3.py and configuration_qwen3.py from the original checkpointNPU (float32) output logits are compared against CPU (float32) baseline across 8 diverse prompts. The comparison uses 4 complementary metrics:
||NPU - CPU||_2 / ||CPU||_2 * 100%| Metric | Value | Threshold | Status |
|---|---|---|---|
| Relative L2 Error | 0.0068% | < 1.0% | PASS |
| Cosine Similarity | 0.99998 | > 0.99 | PASS |
| Top-1 Accuracy | 100.0% (8/8) | > 99% | PASS |
| Top-5 Overlap | 5.0/5 | > 4/5 | PASS |
| # | Prompt (truncated) | rel_L2 (%) | cos_sim | top1 | top5 |
|---|---|---|---|---|---|
| 0 | Hello, how are you doing today? | 0.0052 | 1.000095 | OK | 5/5 |
| 1 | The capital of France is Paris. | 0.0009 | 0.999924 | OK | 5/5 |
| 2 | Once upon a time in a land far away, | 0.0059 | 0.999999 | OK | 5/5 |
| 3 | Artificial intelligence is the future of | 0.0334 | 0.999993 | OK | 5/5 |
| 4 | The speed of light in vacuum is approx | 0.0007 | 0.999927 | OK | 5/5 |
| 5 | Machine learning models can be used for | 0.0064 | 0.999933 | OK | 5/5 |
| 6 | In recent years, deep learning has | 0.0012 | 1.000045 | OK | 5/5 |
| 7 | The most important thing in science is | 0.0005 | 0.999941 | OK | 5/5 |
Verdict: PASS — NPU inference is numerically equivalent to CPU baseline. All 8 prompts achieve perfect top-1 token match and top-5 overlap, with relative L2 error well below the 1% threshold at 0.0068%.
| Metric | Value |
|---|---|
| Throughput | 26.1 tok/s |
| Avg Latency (128 tok) | 4.904 s |
| Median Latency | 4.874 s |
| P99 Latency | 5.287 s |
| Min Latency | 4.638 s |
| Max Latency | 5.314 s |
| NPU Memory (allocated) | 618.1 MB |
| NPU Memory (reserved) | 680.0 MB |
| Model Load Time | 1.9 s |
pip install modelscope transformers torch torch_npumodelscope download --model AutoArk/GPA --local_dir ./GPA_modelimport torch
import torch_npu
from transformers import AutoModelForCausalLM, AutoTokenizer
MODEL_DIR = "./GPA_model"
device = torch.device("npu:0")
model = AutoModelForCausalLM.from_pretrained(
MODEL_DIR,
torch_dtype=torch.bfloat16,
trust_remote_code=True,
).to(device)
model.eval()
tokenizer = AutoTokenizer.from_pretrained(MODEL_DIR, trust_remote_code=True)
inputs = tokenizer("Hello, who are you?", return_tensors="pt").to(device)
outputs = model.generate(**inputs, max_new_tokens=128)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))# Text generation
python inference.py --task text --prompt "Hello!" --max_new_tokens 128
# Accuracy validation (NPU vs CPU)
python inference.py --task accuracy
# Performance benchmark
python inference.py --task benchmark --num_iters 10
# Full evaluation (accuracy + benchmark + demo)
python inference.py --task full --output eval_results.json.
├── inference.py # NPU inference script (text/accuracy/benchmark/memory/full)
├── README.md # This documentation
├── results_accuracy.json # Accuracy evaluation results (JSON)
├── results_benchmark.json # Performance benchmark results (JSON)
├── results_text.json # Text generation results (JSON)
└── GPA_model/ # Model files (downloaded from ModelScope)
├── config.json
├── model.safetensors
├── modeling_qwen3.py
├── configuration_qwen3.py
├── tokenizer.json
├── tokenizer_config.json
├── vocab.json
├── merges.txt
├── generation_config.json
├── chat_template.jinja
├── special_tokens_map.json
├── added_tokens.json
├── BiCodec/
│ ├── config.json
│ ├── model.safetensors
│ └── wav2vec2-large-xlsr-53/
└── glm-4-voice-tokenizer/
├── config.json
├── model.safetensors
└── preprocessor_config.json@misc{gpa2026,
title={Unifying Speech Recognition, Synthesis and Conversion with Autoregressive Transformer},
author={Runyuan Cai, Yu Lin, Yiming Wang, Chunlin Fu and Xiaodong Zeng},
year={2026},
howpublished={\url{https://github.com/AutoArk/GPA}},
}Apache License 2.0
Adapted for Ascend NPU on 2026-05-16