Using Lens throws the good old “ComfyUI execution error: Expected all tensors to be on the same device” error

用户在 SwarmUI 中下载并安装了 Microsoft Lens FP8 两个版本(regular 和 turbo),运行生成时触发该错误。用户提到 SwarmUI 安装过程中曾多次安装和卸载不同的 ComfyUI 节点,怀疑安装环境不干净导致问题。

Using Lens throws the good old "ComfyUI execution error: Expected all tensors to be on the same device" error

Using Lens throws the good old “ComfyUI execution error: Expected all tensors to be on the same device” error

快速结论:在 SwarmUI 中加载 Microsoft Lens(FP8 版本)模型时触发,报错提示张量分布在 cuda:0 和 cpu 两个设备上。优先排查是否有 ComfyUI 节点或依赖版本冲突,尝试全新重新安装 SwarmUI/ComfyUI 后端。

问题场景

用户在 SwarmUI 中下载并安装了 Microsoft Lens FP8 两个版本(regular 和 turbo),运行生成时触发该错误。用户提到 SwarmUI 安装过程中曾多次安装和卸载不同的 ComfyUI 节点,怀疑安装环境不干净导致问题。

报错原文

ComfyUI execution error: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument tensors in method wrapper_CUDA_cat)

[ERROR] !!! Exception during processing !!! Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument tensors in method wrapper_CUDA_cat)

原因分析

可能原因包括:

  • ComfyUI 环境存在节点或依赖冲突,导致某些张量被错误地分配到 CPU 而非 GPU。
  • PyTorch 版本过旧,不兼容 Lens 模型所需的设备处理方式。
  • 属于 ComfyUI 本身的一个 bug,需要向 ComfyUI 团队报告。

目前 Issue 中未给出明确根因,以上均为推测。可优先尝试全新重新安装。

环境排查

  • PyTorch 版本(确认是否为较新版本,如 ≥2.0)
  • CUDA 版本及显卡驱动(确认 GPU 可用,且 torch.cuda.is_available() 返回 True)
  • SwarmUI 和 ComfyUI 后端的安装完整性(是否有残留节点或依赖)
  • Microsoft Lens 模型文件是否完整下载

解决步骤

  1. 备份当前 SwarmUI 的用户配置和自定义节点。
  2. 彻底卸载 SwarmUI,并清理 ComfyUI 后端目录(如 dlbackend/comfy)。
  3. 重新安装最新版 SwarmUI,并让其自动下载 ComfyUI 后端。
  4. 重新下载 Microsoft Lens 模型。
  5. 如果重新安装后问题仍然存在,可尝试更新 PyTorch 到最新稳定版,或在 ComfyUI 的 GitHub 仓库提交 bug 报告。

验证方法

在 SwarmUI 中重新加载 Lens 模型并运行一次正常的生成任务,观察是否不再弹出“Expected all tensors to be on the same device”错误。如果问题依旧,则可能属于 ComfyUI 本身的 bug,需要等待上游修复。

参考来源

mcmonkeyprojects/SwarmUI #1399

GamsGo AI

AI 工具推荐

想把多个 AI 模型放在一个入口?

GamsGo AI 集成 ChatGPT、DeepSeek、Gemini、Claude、Midjourney、Veo 等常用模型,适合写作、绘图、视频和日常 AI 工作流。

了解 GamsGo AI

推广链接:通过此链接购买,我可能获得佣金,不影响你的价格。

celebrityanime
celebrityanime
文章: 7446

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注