Skip to content

Commit

Permalink
Fix Ci Error (#875)
Browse files Browse the repository at this point in the history
最新 comfyui 取消掉了 dont_upcast_attention 参数,

comfyanonymous/ComfyUI@bb4940d#diff-fab3fbd81daf87571b12fb3e4d80fc7d6bbbcf0f3dafed1dbc55d81998d82539L54

<img width="1463" alt="image"
src="https://github.com/siliconflow/onediff/assets/109639975/d9c25360-0ae8-4d4f-89a2-c215d1a03ae6">

下图 comfyui 新使用方式, 避免 _ATTN_PRECISION 这个全局变量,使用 attn_precision 参数。
<img width="1149" alt="image"
src="https://github.com/siliconflow/onediff/assets/109639975/744ea578-3734-4dba-95dd-cc6a97fc1b3d">

Co-authored-by: Xiaoyu Xu <xiaoyulink@gmail.com>
  • Loading branch information
ccssu and strint authored May 15, 2024
1 parent 88acb7a commit 5619461
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion onediff_comfy_nodes/extras_nodes/nodes_oneflow_booster.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
import comfy_extras.nodes_video_model
from nodes import CheckpointLoaderSimple

if not args.dont_upcast_attention:

# https://github.com/comfyanonymous/ComfyUI/commit/bb4940d837f0cfd338ff64776b084303be066c67#diff-fab3fbd81daf87571b12fb3e4d80fc7d6bbbcf0f3dafed1dbc55d81998d82539L54
if hasattr(args, "dont_upcast_attention") and not args.dont_upcast_attention:
os.environ["ONEFLOW_ATTENTION_ALLOW_HALF_PRECISION_SCORE_ACCUMULATION_MAX_M"] = "0"


Expand Down
12 changes: 9 additions & 3 deletions onediff_comfy_nodes/modules/oneflow/utils/booster_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,19 @@ def is_using_oneflow_backend(module):
deep_cache_module = dc_patch_executor.get_patch(module)
if deep_cache_module[0] and isinstance(deep_cache_module[0], DeployableModule):
return True
diff_model = module.model.diffusion_model
return isinstance(diff_model, DeployableModule)
if hasattr(module.model, "diffusion_model"):
diff_model = module.model.diffusion_model
return isinstance(diff_model, DeployableModule)
else:
return False

if isinstance(module, BaseModel):
if dc_patch_executor.is_use_deep_cache_unet(module):
return True
return isinstance(module.diffusion_model, DeployableModule)
if hasattr(module, "diffusion_model"):
return isinstance(module.diffusion_model, DeployableModule)
else:
return False

if isinstance(module, DeployableModule):
return True
Expand Down

0 comments on commit 5619461

Please sign in to comment.