A minimum inference engine for DiffSinger MIDI-less mode.
- Install
onnxruntime
following the official guidance.pip install onnxruntime-gpu
- Install other dependencies with
pip install PyYAML soundfile
. - Download ONNX version of the NSF-HiFiGAN vocoder from here and unzip it into
assets/vocoder
directory. - Download an ONNX rhythm predictor from here and put it into
assets/rhythmizer
directory. - Put your ONNX acoustic models into
assets/acoustic
directory. - Edit
configs/default.yaml
or create another config file according to your preference and local environment. - Run server with
python server.py
orpython server.py --config <YOUR_CONFIG>
.
- 版本信息
GET /version HTTP/1.1
HTTP/1.1 200 OK
{"version": "1.0.1", "date": "2023-01-08"}
- 模型列表
GET /models HTTP/1.1
HTTP/1.1 200 OK
Content-Type:application/json
{"models": ["1215_opencpop_ds1000_fix_label_nomidi"]}
- 生成节奏
POST /rhythm HTTP/1.1
Content-Type:application/json
{
"notes":[
{"key": 0,"duration": 0.5,"slur": false,"phonemes": ["SP"]},
{"key": 69,"duration": 0.5,"slur": false,"phonemes": ["sh","a"]},
{"key": 71,"duration": 1.0,"slur": true}
]
}
HTTP/1.1 200 OK
Content-Type:application/json
{"phonemes":[
{"name": "SP", "duration": 0.235995352268219},
{"name": "sh", "duration": 0.264004647731781},
{"name": "a", "duration": 1.5}
]}
- 提交
POST /submit HTTP/1.1
Content-Type:application/json
{
"model": "1215_opencpop_ds1000_fix_label_nomidi",
"phonemes":[
{"name": "SP", "duration": 0.235995352268219},
{"name": "sh", "duration": 0.264004647731781},
{"name": "a", "duration": 1.5}
],
"f0":{
"timestep": 0.01,
"values": [440.0,440.0,440.0,440.0,440.0]
},
"speedup": 50
}
HTTP/1.1 200 OK
Content-Type:application/json
{
"token": "afbc3057747f0cd98b67f01038855380",
"status": "SUBMITTED",
"code": "ae67"
}
- 查询
POST /query HTTP/1.1
Content-Type:application/json
{"token": "afbc3057747f0cd98b67f01038855380"}
HTTP/1.1 200 OK
Content-Type:application/json
{"status": "HIT_CACHE"}
- 取消任务
POST /cancel HTTP/1.1
Content-Type:application/json
{"token": "afbc3057747f0cd98b67f01038855380","code":"ae67"}
{"succeeded": false,"message": "Task result already in cache."}
- 下载文件
GET /download?token=afbc3057747f0cd98b67f01038855380 HTTP/1.1
HTTP/1.1 200 ok
content-type: audio/wav
- Train with your own dataset or download pretrained checkpoints from here.
- Export PyTorch checkpoints to ONNX format. See instructions here.
请确保你制作数据集的数据来源合法合规,且数据提供者明确你在制作什么以及可能造成的后果 该项目为歌声合成项目,无法进行其他用途,请知晓 本项目数据集来源:Opencpop