Artrajz / vits-simple-api

A simple VITS HTTP API, developed by extending Moegoe with additional features.
GNU Affero General Public License v3.0
822 stars 121 forks source link

部署后 app.py首次执行时报错zipfile.BadZipFile: File is not a zip file #126

Closed Puratoke closed 10 months ago

Puratoke commented 10 months ago

运行环境

问题描述

PS C:\Users\Puratoke\Desktop\hhhao\vits-simple-api> python app.py INFO:root:Loading yaml from C:\Users\Puratoke\Desktop\hhhao\vits-simple-api\config.yml Building prefix dict from the default dictionary ... DEBUG:jieba:Building prefix dict from the default dictionary ... Loading model from cache C:\Users\Puratoke\AppData\Local\Temp\jieba.cache DEBUG:jieba:Loading model from cache C:\Users\Puratoke\AppData\Local\Temp\jieba.cache Loading model cost 0.590 seconds. DEBUG:jieba:Loading model cost 0.590 seconds. Prefix dict has been built successfully. DEBUG:jieba:Prefix dict has been built successfully. Traceback (most recent call last): File "C:\Users\Puratoke\Desktop\hhhao\vits-simple-api\app.py", line 10, in from tts_app import frontend, voice_api, auth, admin File "C:\Users\Puratoke\Desktop\hhhao\vits-simple-api\tts_app__init.py", line 1, in from tts_app.frontend import frontend File "C:\Users\Puratoke\Desktop\hhhao\vits-simple-api\tts_app\frontend__init.py", line 1, in from tts_app.frontend.views import frontend File "C:\Users\Puratoke\Desktop\hhhao\vits-simple-api\tts_app\frontend\views.py", line 3, in from tts_app.model_manager import model_manager File "C:\Users\Puratoke\Desktop\hhhao\vits-simple-api\tts_app\model_manager.py", line 1, in from ModelManager import ModelManager File "C:\Users\Puratoke\Desktop\hhhao\vits-simple-api\ModelManager.py", line 14, in from bert_vits2 import Bert_VITS2 File "C:\Users\Puratoke\Desktop\hhhao\vits-simple-api\bert_vits2__init__.py", line 1, in from bert_vits2.bert_vits2 import Bert_VITS2 File "C:\Users\Puratoke\Desktop\hhhao\vits-simple-api\bert_vits2\bert_vits2.py", line 13, in from bert_vits2.text.cleaner import clean_text File "C:\Users\Puratoke\Desktop\hhhao\vits-simple-api\bert_vits2\text\cleaner.py", line 1, in from bert_vits2.text import chinese, japanese, english, cleaned_text_to_sequence, japanese_v111, chinese_v100, \ File "C:\Users\Puratoke\Desktop\hhhao\vits-simple-api\bert_vits2\text\english.py", line 4, in from g2p_en import G2p File "C:\Users\Puratoke\AppData\Local\Programs\Python\Python310\lib\site-packages\g2p_en\init__.py", line 1, in from .g2p import G2p File "C:\Users\Puratoke\AppData\Local\Programs\Python\Python310\lib\site-packages\g2p_en\g2p.py", line 22, in nltk.data.find('taggers/averaged_perceptron_tagger.zip') File "C:\Users\Puratoke\AppData\Local\Programs\Python\Python310\lib\site-packages\nltk\data.py", line 542, in find return ZipFilePathPointer(p, zipentry) File "C:\Users\Puratoke\AppData\Local\Programs\Python\Python310\lib\site-packages\nltk\compat.py", line 41, in _decorator return init_func(*args, **kwargs) File "C:\Users\Puratoke\AppData\Local\Programs\Python\Python310\lib\site-packages\nltk\data.py", line 394, in init zipfile = OpenOnDemandZipFile(os.path.abspath(zipfile)) File "C:\Users\Puratoke\AppData\Local\Programs\Python\Python310\lib\site-packages\nltk\compat.py", line 41, in _decorator return init_func(*args, **kwargs) File "C:\Users\Puratoke\AppData\Local\Programs\Python\Python310\lib\site-packages\nltk\data.py", line 935, in init zipfile.ZipFile.init(self, filename) File "C:\Users\Puratoke\AppData\Local\Programs\Python\Python310\lib\zipfile.py", line 1269, in init__ self._RealGetContents() File "C:\Users\Puratoke\AppData\Local\Programs\Python\Python310\lib\zipfile.py", line 1336, in _RealGetContents raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file

问题复现步骤

按照文档教程进行的部署,Windows部署包在启动bat后就产生了错误,自己搭建环境时唯一区别是将pyopentalk更换为了0.3.3,其余与文档一致,产生了同样的错误 搜索zipfile.BadZipFile: File is not a zip file时并没有查询到情况相似的解决方式,因为比较小白,所以提出的问题如果太基础或者过于蠢爆了的话恳请大佬们无视就好,如果愿意给出一些小小的帮助的话万分感谢您的举手之劳 asdsad6

Artrajz commented 10 months ago

由于没有遇到过所以我也只能猜测下解决办法。从日志上看起来是nltk模块在下载zip时,由于某种原因没有下载完整,导致无法解压。

可以下载我打包好的nltk_data.zip,解压到任意一个盘符的根目录,然后重新启动项目试试。

Puratoke commented 10 months ago

您好,非常感谢您的帮助!使用您的文件将C:\Users\用户名\AppData\Roaming\nltk_data原有文件覆盖后重新启动一切正常,在此向您表达真诚地感谢!