-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inference 60 characters, cost 0.86 sencond on cpu, how to acceleration time #4
Comments
maybe you can convert model to onnx and use onnxruntime, check pr in #5 |
谢谢,对g2pw代码进行了修改:dataloader也进行了相应修改,最后改成直接预测一整句话,速度大概在0.07~0.13s左右。也是在paddle下增加了g2pw选项。 |
@liuhuang31 |
Thanks for your response, i want to give a PR, it is much convenient. |
@liuhuang31 Thank you! I am looking forward your PR. |
Hi, could you please tell me how to use |
Hi, the newest code default use OnnxConverter model to predict, so just install the newest code and use it. |
解决了嘛,没解决话是又遇到啥问题了呢~ @beyondguo |
@liuhuang31 from g2pw import G2PWConverter
conv = G2PWConverter(style='pinyin', enable_non_tradional_chinese=True)
%timeit conv('然而,他红了20年以后,他竟退出了大家的视线。') 平均时长:
不是初次加载模型,是每次跑都差不多这个时间。我现在的需求是对一个大语料库做注音,所以希望推理速度快一点。 |
@beyondguo 你可以看看我的pull request, 我在旧的版本上,60个字能达到0.08-0.13秒。 |
@liuhuang31 >>> %timeit conv('然而,他红了20年以后,他竟退出了大家的视线。')
<<< 1.44 s ± 39.3 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) 然而更慢了,不知道我是哪里用错了吗[Lol] |
@beyondguo 应该没用对,等有时间再跟你讨论,我先忙工作事情,比较紧急 |
确实慢,有办法做模型精简吗?onnx也慢。 |
g2pw每次预测会先做句子分词,然后一句话可能会分成10次,那么就要调用10次去预测。 可以参考之前的一个代码,大概逻辑是:循环生成数据变成只一次就生成预测数据;模型循环预测变成只一次调用模型。 |
hi,
Thanks the provided code and model.
When i use the g2pw to do g2p, it cost too long time.
conv = G2PWConverter(style='pinyin', enable_non_tradional_chinese=True)
I inference 60 characters, cost 0.86s on cpu, have any way to accelerate it? Thanks again.
The text was updated successfully, but these errors were encountered: