-
Notifications
You must be signed in to change notification settings - Fork 938
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
NoneType object has no attribute set_input_shape #869
Comments
改成了在线导出tensorrt模型,先启动一个线程,导出成功后,再启动其他线程 |
解决方案 import threading
import multiprocessing as mp
from funasr import AutoModel
from cosyvoice.cli.cosyvoice import CosyVoice, CosyVoice2
import asyncio
import os
from loguru import logger
async def main(pid, logger):
pass
def export_tensorrt_model():
"""导出 TensorRT 模型的代码"""
global SenseVoiceModel
global CosyVoiceModel
SenseVoiceModel = AutoModel()
CosyVoiceModel = CosyVoice2(model_id, load_jit=False, load_trt=False, fp16=False)
def worker_process():
# 启动一个线程来导出 TensorRT 模型
export_thread = threading.Thread(target=export_tensorrt_model)
export_thread.start()
export_thread.join() # 等待导出完成
asyncio.run(main(os.getpid(), logger))
if __name__ == "__main__":
processes = []
for _ in range(SUB_PROCESS):
p = mp.Process(target=worker_process)
p.start()
processes.append(p)
for p in processes:
p.join() 但是我如果这样子写,依然会报错 CosyVoiceModel = CosyVoice2(model_id, load_jit=False, load_trt=True, fp16=False) 不加载 load_trt 不会报错: CosyVoiceModel = CosyVoice2(model_id, load_jit=False, load_trt=False, fp16=True) |
尝试改了代码,是 load_trt=True 的问题导致的,并且我在测试的时候,多线程没有一次成功的。
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
更新了今天(2025-01-10)最新的代码与模型(CosyVoice2-0.5B),我运行的是多线程方式。
在运行
CosyVoiceModel.inference_cross_lingual(tts_text, prompt_speech_16k)
后报错如下感谢。
The text was updated successfully, but these errors were encountered: