GPT-SoVITS
GPT-SoVITS copied to clipboard
fix bug and refactor the text processing code to python fstring syntax
- change to python syntax: I have notice that this project has widely used C syntax to process text, which might cause enormous readilbility problem. I change most of it to python f string and tested the function completeness. It should be functionally the same as the old version and do not cause any problem.
- fix bug: When text and word2ph is empty, get_bert_feature will crash because the torch.cat cannot receive empty text&word2ph. The version added a validation to return empty torch when receive empty text.
I understand that the syntax changing may greatly affect the project, but I still hope that the syntax can be adopted for the ease of development. But even if the syntax cannot be changed due to other reasons, I hope the maintainer can add the validation in for robustness.
@RVC-Boss 麻烦老哥看一下 修改 Python 語法:專案廣泛使用 C 語法處理文本,可能會導致嚴重的可讀性問題。我將大部分內容修改為 Python fstring,並測試了函數的完整性。修改後的功能應該與舊版本相同,不會引發任何問題。 修復錯誤:當文字和 word2ph 為空時,get_bert_feature 會崩潰,因為 torch.cat 無法接收空文字和 word2ph。新版本新增了驗證,當接收到空文字時傳回空的 torch。
我理解語法的更改可能會對專案造成很大影響,但我仍然希望能夠採用這種語法以方便開發。即使由於其他原因無法更改語法,我也希望維護者能夠添加驗證以確保其健壯性。