PaddlePaddle / FastDeploy

⚡️An Easy-to-use and Fast Deep Learning Model Deployment Toolkit for ☁️Cloud 📱Mobile and 📹Edge. Including Image, Video, Text and Audio 20+ main stream scenarios and 150+ SOTA models with end-to-end optimization, multi-platform and multi-framework support.
https://www.paddlepaddle.org.cn/fastdeploy
Apache License 2.0
3.01k stars 465 forks source link

F0320 08:45:55.725492 11628 memory_optimize_pass.cc:95] Check failed: i >= 0 (-1 vs. 0) #2408

Open xn3469010 opened 8 months ago

xn3469010 commented 8 months ago

from pathlib import Path import soundfile as sf import os from paddlespeech.t2s.exps.syn_utils import get_am_output from paddlespeech.t2s.exps.syn_utils import get_frontend from paddlespeech.t2s.exps.syn_utils import get_predictor from paddlespeech.t2s.exps.syn_utils import get_voc_output

def get_text_dict(name: str, txtname: str): ff = open(txtname, "r", encoding="utf-8") msg = ff.read() ff.close() text_list = msg.split("\n") text_dict = {} num = 0 for i in text_list: text_dict[name + str(num)] = i num += 1 print(f"{name}text:{num}") return text_dict

def the_main(text_dict):

frontend

frontend = get_frontend(
    lang="mix",
    phones_dict=os.path.join(am_inference_dir, "phone_id_map.txt"),
    tones_dict=None
)

# am_predictor
am_predictor = get_predictor(
    model_dir=am_inference_dir,
    model_file="fastspeech2_mix" + ".pdmodel",
    params_file="fastspeech2_mix" + ".pdiparams",
    device=device)
# voc_predictor
voc_predictor = get_predictor(
    model_dir=voc_inference_dir,
    model_file="pwgan_aishell3" + ".pdmodel",  # 这里以 pwgan_aishell3 为例子,其它模型记得修改此处模型名称
    params_file="pwgan_aishell3" + ".pdiparams",
    device=device)
output_dir = Path(wav_output_dir)
output_dir.mkdir(parents=True, exist_ok=True)
sentences = list(text_dict.items())
merge_sentences = True
fs = 24000
for utt_id, sentence in sentences:
    am_output_data = get_am_output(
        input=sentence,
        am_predictor=am_predictor,
        am="fastspeech2_mix",
        frontend=frontend,
        lang="mix",
        merge_sentences=merge_sentences,
        speaker_dict=os.path.join(am_inference_dir, "phone_id_map.txt"),
        spk_id=0, )
    wav = get_voc_output(
        voc_predictor=voc_predictor, input=am_output_data)
    # 保存文件
    sf.write(output_dir / (utt_id + ".wav"), wav, samplerate=fs)
return

if name == 'main':

模型路径

am_inference_dir = "doubao_01"
# 声码器路径,这里以 pwgan_aishell3 为例子
voc_inference_dir = "pwgan_aishell3_static_1.1.0"
# 音频生成的路径,修改成你音频想要保存的路径
wav_output_dir = "output"
# 选择设备[gpu / cpu],这里以GPU为例子,
device = "cpu"
# 想要生成的文本文档对应文件名
txt_name = "demo.txt"
the_main(get_text_dict(name=am_inference_dir, txtname=txt_name))

D:\ruanjian\ad3\envs\FJ_DEMO\python.exe D:\work\py\feijiang\main.py D:\ruanjian\ad3\envs\FJ_DEMO\lib\site-packages\lazy_loader__init.py:185: RuntimeWarning: subpackages can technically be lazily loaded, but it causes the package to be eagerly loaded even if it is already lazily loaded.So, you probably shouldn't use subpackages with this lazy feature. warnings.warn(msg, RuntimeWarning) D:\ruanjian\ad3\envs\FJ_DEMO\lib\site-packages_distutils_hack__init.py:33: UserWarning: Setuptools is replacing distutils. warnings.warn("Setuptools is replacing distutils.") doubao_01text:1 doubao_01text:2 [2024-03-20 08:45:52,493] [ INFO] - Already cached C:\Users\Administrator.paddlenlp\models\bert-base-chinese\bert-base-chinese-vocab.txt [2024-03-20 08:45:52,516] [ INFO] - tokenizer config file saved in C:\Users\Administrator.paddlenlp\models\bert-base-chinese\tokenizer_config.json [2024-03-20 08:45:52,516] [ INFO] - Special tokens file saved in C:\Users\Administrator.paddlenlp\models\bert-base-chinese\special_tokens_map.json e[1me[35m--- Running analysis [ir_graph_build_pass]e[0m I0320 08:45:54.643479 11628 executor.cc:187] Old Executor is Running. e[1me[35m--- Running analysis [ir_analysis_pass]e[0m e[32m--- Running IR pass [simplify_with_basic_ops_pass]e[0m e[32m--- Running IR pass [layer_norm_fuse_pass]e[0m e[32m--- Running IR pass [attention_lstm_fuse_pass]e[0m e[32m--- Running IR pass [seqconv_eltadd_relu_fuse_pass]e[0m e[32m--- Running IR pass [seqpool_cvm_concat_fuse_pass]e[0m e[32m--- Running IR pass [mul_lstm_fuse_pass]e[0m e[32m--- Running IR pass [fc_gru_fuse_pass]e[0m e[32m--- Running IR pass [mul_gru_fuse_pass]e[0m e[32m--- Running IR pass [seq_concat_fc_fuse_pass]e[0m e[32m--- Running IR pass [gpu_cpu_squeeze2_matmul_fuse_pass]e[0m e[32m--- Running IR pass [gpu_cpu_reshape2_matmul_fuse_pass]e[0m e[32m--- Running IR pass [gpu_cpu_flatten2_matmul_fuse_pass]e[0m e[32m--- Running IR pass [matmul_v2_scale_fuse_pass]e[0m e[32m--- Running IR pass [gpu_cpu_map_matmul_v2_to_mul_pass]e[0m I0320 08:45:54.957129 11628 fuse_pass_base.cc:59] --- detected 37 subgraphs e[32m--- Running IR pass [gpu_cpu_map_matmul_v2_to_matmul_pass]e[0m I0320 08:45:54.967124 11628 fuse_pass_base.cc:59] --- detected 17 subgraphs e[32m--- Running IR pass [matmul_scale_fuse_pass]e[0m I0320 08:45:54.977124 11628 fuse_pass_base.cc:59] --- detected 8 subgraphs e[32m--- Running IR pass [gpu_cpu_map_matmul_to_mul_pass]e[0m e[32m--- Running IR pass [fc_fuse_pass]e[0m I0320 08:45:55.071126 11628 fuse_pass_base.cc:59] --- detected 37 subgraphs e[32m--- Running IR pass [repeated_fc_relu_fuse_pass]e[0m e[32m--- Running IR pass [squared_mat_sub_fuse_pass]e[0m e[32m--- Running IR pass [conv_bn_fuse_pass]e[0m e[32m--- Running IR pass [conv_eltwiseadd_bn_fuse_pass]e[0m e[32m--- Running IR pass [conv_transpose_bn_fuse_pass]e[0m e[32m--- Running IR pass [conv_transpose_eltwiseadd_bn_fuse_pass]e[0m e[32m--- Running IR pass [is_test_pass]e[0m e[32m--- Running IR pass [constant_folding_pass]e[0m I0320 08:45:55.720499 11628 fuse_pass_base.cc:59] --- detected 171 subgraphs e[1me[35m--- Running analysis [save_optimized_model_pass]e[0m e[1me[35m--- Running analysis [ir_params_sync_among_devices_pass]e[0m e[1me[35m--- Running analysis [adjust_cudnn_workspace_size_pass]e[0m e[1me[35m--- Running analysis [inference_op_replace_pass]e[0m e[1me[35m--- Running analysis [memory_optimize_pass]e[0m F0320 08:45:55.725492 11628 memory_optimize_pass.cc:95] Check failed: i >= 0 (-1 vs. 0) Check failure stack trace: @ 00007FFF7B895025 PyIniteval_frame @ 00007FFF7B8945D2 PyIniteval_frame @ 00007FFF7D7D90F8 class paddle::Tensor cdecl paddle::from_blob(void ptr64,class paddle::experimental::IntArrayBase const & ptr64,enum phi::DataType,enum common::DataLayout,class phi::Place const & ptr64,class std::function<void cdecl(v @ 00007FFF7D7DA5D6 class paddle::Tensor __cdecl paddle::from_blob(void ptr64,class paddle::experimental::IntArrayBase const & ptr64,enum phi::DataType,enum common::DataLayout,class phi::Place const & ptr64,class std::function<void cdecl(v @ 00007FFF7D7CF609 class paddle::Tensor cdecl paddle::from_blob(void * ptr64,class paddle::experimental::IntArrayBase const & ptr64,enum phi::DataType,enum common::DataLayout,class phi::Place const & ptr64,class std::function<void cdecl(v @ 00007FFF7B9AC455 class std::basic_string<char,struct std::char_traits,class std::allocator > cdecl paddle_infer::GetVersion(void) @ 00007FFF7B9AB539 class std::basic_string<char,struct std::char_traits,class std::allocator > __cdecl paddle_infer::GetVersion(void) @ 00007FFF7B99C7CF class std::unique_ptr<class paddle::PaddlePredictor,struct std::default_delete > cdecl paddle::CreatePaddlePredictor<struct paddle::AnalysisConfig,2>(struct paddle::AnalysisConfig const & ptr64) @ 00007FFF7B9A3C5B public: cdecl paddle_infer::Predictor::Predictor(struct paddle::AnalysisConfig const & ptr64) ptr64 @ 00007FFF7B634C7D public: class paddle::ZeroCopyTensor & ptr64 cdecl paddle::ZeroCopyTensor::operator=(class paddle::ZeroCopyTensor const & ptr64) ptr64 @ 00007FFF7B60E1B6 PyInit_libpaddle @ 00007FFF7B2FE469 public: class paddle::OpMetaInfoBuilder & ptr64 cdecl paddle::OpMetaInfoBuilder::operator=(class paddle::OpMetaInfoBuilder const & ptr64) ptr64 @ 00007FFF885882C6 PyCFunction_GetFlags @ 00007FFF8854551C _PyObject_MakeTpCall @ 00007FFF8863E6C2 PyEval_GetFuncDesc @ 00007FFF8863AE6F _PyEval_EvalFrameDefault @ 00007FFF8863CE4B _PyEval_EvalFrameDefault @ 00007FFF8854582E _PyFunction_Vectorcall @ 00007FFF88636179 _PyOS_URandomNonblock @ 00007FFF8863E6C2 PyEval_GetFuncDesc @ 00007FFF8863AED8 _PyEval_EvalFrameDefault @ 00007FFF8863CE4B _PyEval_EvalFrameDefault @ 00007FFF8854582E _PyFunction_Vectorcall @ 00007FFF88636179 _PyOS_URandomNonblock @ 00007FFF8863E6C2 PyEval_GetFuncDesc @ 00007FFF8863A8B2 _PyEval_EvalFrameDefault @ 00007FFF8863CE4B _PyEval_EvalFrameDefault @ 00007FFF88637892 PyEval_EvalCode @ 00007FFF886AE05E PyRun_FileExFlags @ 00007FFF886AE138 PyRun_FileExFlags @ 00007FFF886ADCE8 PyRun_StringFlags @ 00007FFF886ABF45 _PyRun_SimpleFileObject

进程已结束,退出代码为 -1073740791 (0xC0000409)

请问这个报错是为什么?找不到解决办法了。

Jiang-Jia-Jun commented 8 months ago

看起来是PaddleSpeech的问题,建议在相关Repo下重提一下issue