ComfyUI WD1.4 反推提示词插件执行报错

文章讲述了用户在使用WD1.4插件时遇到onnxruntime与TensorRTGPU版本集成的错误,报错提示需安装TensorRT并配置环境。解决方案是在wd14tagger.py文件中指定特定的执行提供者,最终成功避免了错误并重启comfyui以执行反推提示词。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

背景说明

  1. 已下载安装好WD1.4插件到comfyui中。
  2. 安装的依赖模块onnxruntime是onnxruntime-gpu的版本。

报错信息

got prompt
       2 0 2 4 - 0 3 - 3 0   0 0 : 0 6 : 2 6 . 8 0 4 1 9 5 2   [ E : o n n x r u n t i m e : D e f a u l t ,   p r o v  d e r _ b r i d g e _ o r t . c c : 1 5 3 4   o n n x r u n t i m e : : T r y G e t P r o v i d e r I n f o _ T e n s o r R T ]   D : \ a \ _ w o r k \ 1 \ s \ o n n x r u n t i m e \ c o r e \ s e s s i o n \ p r o v i d e r _ b r i d g e _ o r t . c c : 1 2 0 9   o n n x r u n t i m e : : P r o v i d e r L i b r a r y : : G e t   [ O N N X R u n t i m e E r r o r ]   :   1   :   F A I L   :   L o a d L i b r a r y   f a i l e d   w i t h   e r r o r   1 2 6   " "   w h e n   t r y i n g   t o   l o a d   " E : \ P r o g r a m D a t a \ a n a c o n d a 3 \ e n v s \ c o m f y \ L i b \ s i t e - p a c k a g e s \ o n n x r u n t i m e \ c a p i \ o n n x r u n t i m e _ p r o v i d e r s _ t e n s o r r t . d l l "

 *************** EP Error ***************
EP Error D:\a\_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:456 onnxruntime::python::RegisterTensorRTPluginsAsCustomOps Please install TensorRT libraries as mentioned in the GPU requirements page, make sure they're in the PATH or LD_LIBRARY_PATH, and that your GPU is supported.
 when using ['TensorrtExecutionProvider', 'CUDAExecutionProvider', 'CPUExecutionProvider']
Falling back to ['CUDAExecutionProvider', 'CPUExecutionProvider'] and retrying.
****************************************

解决方式

  1. 进入WD插件制品目录下,打开wd14tagger.py文件。
  2. 定位到47行,做一下修改
   #model = InferenceSession(name, providers=ort.get_available_providers())
   providers = [
    ('CUDAExecutionProvider', {
        'device_id': 0,
    }),
    'CPUExecutionProvider',
    ]
    model = InferenceSession(name, providers=providers)
    
  1. 重启comfyui,执行反推提示词就不再报错。
<think>好的,我现在要解决用户关于ComfyUI中joy_caption_two插件报错的问题。首先,我需要回忆一下用户提供的引用内容,看看有没有相关的解决方案。用户提到了引用[3]中提到了安装步骤和问题解决,引用[4]有安装指南,可能里面有提到常见错误。 首先,常见的插件报错可能和依赖项缺失有关。比如,用户是否安装了必要的CLIP模型?引用[3]提到需要下载CLIP模型,如果用户没有正确下载或放置模型文件,插件可能无法运行。我应该建议用户检查模型路径是否正确,确保模型文件放在指定的目录下,比如custom_nodes/ComfyUI_SLK_joy_caption_two-main/clip_models。 其次,用户可能缺少其他依赖的插件。比如,引用[2]提到可能需要ComfyUI_LayerStyle或者专门适配的插件。如果用户没有安装这些前置插件,joy_caption_two可能无法正常工作。需要提醒用户通过ComfyUI Manager安装相关依赖,或者按照引用[3]的方法搜索并安装。 另外,Python包的版本冲突也可能导致报错。例如,某些库如torch、transformers的版本不兼容。建议用户检查是否满足插件要求的版本,可能需要更新或降级某些包。引用[4]或[3]可能提到具体的版本要求,用户需要根据文档进行调整。 还有,用户的环境配置是否正确?比如CUDA版本是否与安装的PyTorch匹配,如果没有正确配置GPU支持,可能导致插件运行错误。需要建议用户验证CUDA和PyTorch的兼容性,并重新安装适合的版本。 如果错误信息涉及特定模块找不到,比如提示缺少某个模块,可能是插件安装不完整。用户应该重新安装插件,确保所有文件正确复制到custom_nodes目录,并重启ComfyUI。引用[3]提到通过ComfyUI Manager安装,或者手动下载并解压到对应目录。 最后,查看日志文件是解决报错的关键步骤。用户应该检查ComfyUI错误日志,定位具体的错误信息,根据日志中的提示进行排查。如果问题依然存在,建议用户到GitHub提交issue,附上日志和复现步骤,或者参考引用[4]中的在线资源获取帮助。</think>关于ComfyUI中joy_caption_two插件报错问题,以下是分步解决方案: ### 一、基础环境检查 1. **确认CLIP模型安装** 必须下载以下模型文件并放置在: `custom_nodes/ComfyUI_SLK_joy_caption_two-main/clip_models` 所需模型清单: - CLIP-ViT-H-14-laion2B-s32B-b79K (推荐) - CLIP-ViT-L-14-laion2B-s32B-b82K - CLIP-ViT-bigG-14-laion2B-s39B-b160k[^3] 2. **检查依赖插件** 需通过ComfyUI Manager安装以下依赖项: - `ComfyUI_LayerStyle` (若使用高级模式) - `ComfyUI-WD14-Tagger` (若需混合反推)[^2] ### 二、典型错误解决方案 #### 案例1:`ModuleNotFoundError` ```python # 报错示例 ImportError: cannot import name 'CLIPImageProcessor' from 'transformers' ``` **解决方法**: 升级`transformers`库: ```bash pip install transformers>=4.26.0 ``` #### 案例2:`CUDA out of memory` ```python # 报错示例 RuntimeError: CUDA out of memory. ``` **解决方法**: 在`joy_caption_two.py`中添加显存优化参数: ```python # 修改前 pipe = pipeline(...) # 修改后 pipe = pipeline(..., device_map="auto", torch_dtype=torch.float16) ``` ### 三、进阶配置 1. **多模式反推配置** 在`config.json`中设置混合反推参数: ```json { "mode": "hybrid", "clip_weight": 0.7, "wd14_threshold": 0.35 } ``` (需同时安装WD14-Tagger插件)[^4] 2. **性能优化建议** - 设置`--lowvram`启动参数减少显存占用 - 对超过2048x2048的图片启用`tile_mode` ### 四、日志分析方法 通过控制台输出定位错误: ```bash # Windows系统查看日志 type comfyui.log | findstr "joy_caption" # Linux/Mac系统 grep "joy_caption" comfyui.log ```
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值