Artrajz / vits-simple-api

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

用docker-compose部署的时候,几个模型文件会挂载为目录 #94

Closed XMing673 closed 1 year ago

XMing673 commented 1 year ago

用docker-compose部署的时候,模型文件会挂载为目录,手动上传模型替换目录后会提示 Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/opt/1panel/docker/compose/vits-simple-api/bert_vits2/bert/chinese-roberta-wwm-ext-large/pytorch_model.bin" to rootfs at "/app/bert_vits2/bert/chinese-roberta-wwm-ext-large/pytorch_model.bin": mount /opt/1panel/docker/compose/vits-simple-api/bert_vits2/bert/chinese-roberta-wwm-ext-large/pytorch_model.bin:/app/bert_vits2/bert/chinese-roberta-wwm-ext-large/pytorch_model.bin (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

另:在1Panel的容器编排中使用docker-compose.yaml文件部署

Artrajz commented 1 year ago

抱歉,上次修改docker-compose.yaml时忘记把挂载路径改回去了,现在可以重新下载一次docker-compose.yaml使用。

XMing673 commented 1 year ago

谢谢帮助,这个问题解决了,但是还有个问题,部署成功容器运行起来后服务器直接卡死了,不知道什么原因o(╥﹏╥)o

用的是腾讯云的轻量服务器,2c4g的配置,除了本项目外还有其他的容器在运行

Artrajz commented 1 year ago

服务器配置是足够的吗?不加载模型可以正常启动吗?还有logs里的日志可以看一下。

XMing673 commented 1 year ago

docker-compose up successful!以后过了几秒钟就直接卡死了,还没来得及加载模型,日志也来不及看,可能是我这边什么东西冲突了,我排除一下看看,希望不是和面板冲突QAQ

XMing673 commented 1 year ago

QQ截图20231112192758 这是compose拉好镜像以后的情况,config.py和gunicorn_config.py替换好以后可以运行容器,访问链接也可以看到webui,但是因为pytorch_model.bin模型找不到,好像是不能加载vits模型

QQ截图20231112192719 这是刚拉好后bert_vits2/bert/chinese-roberta-wwm-ext-large里的情况,模型还是挂载成文件夹了,同时上面的两个文件似乎是因为找不到的原因也被用文件夹替代了,不知道是不是挂载问题

麻烦大大再帮看下,麻烦了

Artrajz commented 1 year ago

一些文件被当成文件夹来挂载是docker compose所致,你现在的情况我建议把这些文件都清空。如果网络可以的话,使用文档中给的安装脚本,脚本会下载所需的文件。如果网络不行,那只能手动下载了。如果是使用Bert-VITS2,可以查看Bert-VITS2的release,有提供境内下载方式。

XMing673 commented 1 year ago

网络应该是没问题,腾讯云东京的服务器,用1panel的compose搭是想图方便管理,没想到更麻烦哈哈哈哈,行叭,咱这边换脚本试试看,谢谢啦

Artrajz commented 1 year ago

其实脚本中也是使用docker compose(),只是会提前下载文件来占位,这样就不会被docker compose当成文件夹来挂载

XMing673 commented 1 year ago

image 大概似乎好像可能也许还是被文件夹占了() 要下啥之前先去对应目录把文件夹删了就可以

XMing673 commented 1 year ago

INFO:root:Loading yaml from /app/config.yml 2023-11-12 20:13:06 [ERROR] [logger.handle_exception:46] Uncaught exception Traceback (most recent call last): File "/usr/local/bin/gunicorn", line 8, in sys.exit(run()) File "/usr/local/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 67, in run WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run() File "/usr/local/lib/python3.10/site-packages/gunicorn/app/base.py", line 236, in run super().run() File "/usr/local/lib/python3.10/site-packages/gunicorn/app/base.py", line 72, in run Arbiter(self).run() File "/usr/local/lib/python3.10/site-packages/gunicorn/arbiter.py", line 58, in init self.setup(app) File "/usr/local/lib/python3.10/site-packages/gunicorn/arbiter.py", line 118, in setup self.app.wsgi() File "/usr/local/lib/python3.10/site-packages/gunicorn/app/base.py", line 67, in wsgi self.callable = self.load() File "/usr/local/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 58, in load return self.load_wsgiapp() File "/usr/local/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp return util.import_app(self.app_uri) File "/usr/local/lib/python3.10/site-packages/gunicorn/util.py", line 371, in import_app mod = importlib.import_module(module) File "/usr/local/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/app/app.py", line 9, in from tts_app import frontend, voice_api, auth, admin File "/app/tts_app/init.py", line 1, in from tts_app.frontend import frontend File "/app/tts_app/frontend/init.py", line 1, in from tts_app.frontend.views import frontend File "/app/tts_app/frontend/views.py", line 3, in from tts_app.model_manager import model_manager File "/app/tts_app/model_manager.py", line 1, in from ModelManager import ModelManager File "/app/ModelManager.py", line 22, in from vits.text.vits_pinyin import VITS_PinYin File "/app/vits/text/vits_pinyin.py", line 9, in from vits.bert.prosody_tool import pinyin_dict ModuleNotFoundError: No module named 'vits.bert.prosody_tool'

新问题出现了(¦3」∠) 终于能看到日志了(bushi)

Artrajz commented 1 year ago

重构之后代码导入出现问题,未加载vits模型也尝试加载bert模型,现已通过懒加载导入模块来修复。