Skip to content

Conversation

@strint
Copy link

@strint strint commented Oct 22, 2025

启动 comfyui 的命令要加上环境变量 MMAP_MEM_THRESHOLD_GB=5,含义是若 cpu mem 小于 5G 时,遇到 offload 会 offload 到 mmap,避免爆 cpu 内存

Convert a tensor to a memory-mapped CPU tensor using PyTorch's native mmap support.
"""
# Move to CPU if needed
if t.is_cuda:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

考虑到 comfyui 可能要适配其它的硬件,比如摩尔的 musa,(摩尔上的显卡tensor,t.is_cuda 返回 False,t.is_musa 才是 True)。

这里的条件是否改成

if not t._is_cpu

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok,晚点改个兼容 musa 的情况

@ccssu
Copy link

ccssu commented Nov 14, 2025

问题描述

comfyui cpu oom
ComfyUI execute prompt error, please check the prompt (Wait ComfyUI prompt execution got unexpected error: ConnectionClosedError(no close frame received or sent))

复现

云函数地址:https://cloud.siliconflow.cn/sft-d1s6t1r3jrms73f3ltpg/dedicated/functions/fniglisnqx?tab=definition

公网 API 端点: https://fniglisnqx.fn.6scloud.com
工作流:
cpu_oom_workflow.json
cpu_oom_workflow_api.json

环境信息

  • cce镜像comfyui: hub.6scloud.com/d1s6t1r3jrms73f3ltpg/comfyui-gpu-torch2dot5:v202511141302-test-on-latest-cpu-offload-default-607450b 关联 comfyui commit :dc7c77e78cb219f149c448cb961ae5122be7ce6b
  • comfyagent: hub.6scloud.com/d1r7umcsfi9c73b4drdg/comfyagent:ComfyAgent-20251112-9a1c1b18

@strint
Copy link
Author

strint commented Nov 14, 2025

问题描述

comfyui cpu oom ComfyUI execute prompt error, please check the prompt (Wait ComfyUI prompt execution got unexpected error: ConnectionClosedError(no close frame received or sent))

复现

云函数地址:https://cloud.siliconflow.cn/sft-d1s6t1r3jrms73f3ltpg/dedicated/functions/fniglisnqx?tab=definition

公网 API 端点: https://fniglisnqx.fn.6scloud.com 工作流: cpu_oom_workflow.json cpu_oom_workflow_api.json

环境信息

  • cce镜像comfyui: hub.6scloud.com/d1s6t1r3jrms73f3ltpg/comfyui-gpu-torch2dot5:v202511141302-test-on-latest-cpu-offload-default-607450b 关联 comfyui commit :dc7c77e78cb219f149c448cb961ae5122be7ce6b
  • comfyagent: hub.6scloud.com/d1r7umcsfi9c73b4drdg/comfyagent:ComfyAgent-20251112-9a1c1b18

看了工作流,里面有比较大的 lora 总共超过了 5G,所以那块有很大可能导致 OOM

可以先试下这个版本,增加了 lora 的 mmap:#8

@ccssu
Copy link

ccssu commented Nov 14, 2025

看了工作流,里面有比较大的 lora 总共超过了 5G,所以那块有很大可能导致 OOM

应该不是lora的问题,我把 lora取消掉还是会cpu oom

@strint
Copy link
Author

strint commented Nov 20, 2025

问题描述

comfyui cpu oom ComfyUI execute prompt error, please check the prompt (Wait ComfyUI prompt execution got unexpected error: ConnectionClosedError(no close frame received or sent))

复现

云函数地址:https://cloud.siliconflow.cn/sft-d1s6t1r3jrms73f3ltpg/dedicated/functions/fniglisnqx?tab=definition

公网 API 端点: https://fniglisnqx.fn.6scloud.com 工作流: cpu_oom_workflow.json cpu_oom_workflow_api.json

环境信息

  • cce镜像comfyui: hub.6scloud.com/d1s6t1r3jrms73f3ltpg/comfyui-gpu-torch2dot5:v202511141302-test-on-latest-cpu-offload-default-607450b 关联 comfyui commit :dc7c77e78cb219f149c448cb961ae5122be7ce6b
  • comfyagent: hub.6scloud.com/d1r7umcsfi9c73b4drdg/comfyagent:ComfyAgent-20251112-9a1c1b18

测试工作流只有 clip 能走到 comfyui 的 model_unload 逻辑,看工作流里面大部分节点都是第三方节点,他们的 offload 看起来是第三方节点内部做的,不受 comfyui 控制了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants