siliconflow / onediff

OneDiff: An out-of-the-box acceleration library for diffusion models.
https://github.com/siliconflow/onediff/wiki
Apache License 2.0
1.72k stars 107 forks source link

[Bug] name 'is_disable_oneflow_backend' is not defined #1075

Open Ner1Co opened 3 months ago

Ner1Co commented 3 months ago

Your current environment information

libibverbs not available, ibv_fork_init skipped
Collecting environment information...
PyTorch version: 2.1.2+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A

OneFlow version: path: ['/home/neria/ai_onediff_example/.venv/lib/python3.10/site-packages/oneflow'], version: 0.9.1.dev20240515+cu122, git_commit: ec7b682, cmake_build_type: Release, rdma: True, mlir: True, enterprise: False
Nexfort version: none
OneDiff version: 1.2.0.dev1
OneDiffX version: none

OS: Debian GNU/Linux 11 (bullseye) (x86_64)
GCC version: (Debian 10.2.1-6) 10.2.1 20210110
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.31

Python version: 3.10.4 (main, Apr 30 2024, 14:10:28) [GCC 10.2.1 20210110] (64-bit runtime)
Python platform: Linux-5.10.0-31-cloud-amd64-x86_64-with-glibc2.31
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA A100-SXM4-40GB
Nvidia driver version: 550.54.15
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                         x86_64
CPU op-mode(s):                       32-bit, 64-bit
Byte Order:                           Little Endian
Address sizes:                        46 bits physical, 48 bits virtual
CPU(s):                               12
On-line CPU(s) list:                  0-11
Thread(s) per core:                   2
Core(s) per socket:                   6
Socket(s):                            1
NUMA node(s):                         1
Vendor ID:                            GenuineIntel
CPU family:                           6
Model:                                85
Model name:                           Intel(R) Xeon(R) CPU @ 2.20GHz
Stepping:                             7
CPU MHz:                              2200.210
BogoMIPS:                             4400.42
Hypervisor vendor:                    KVM
Virtualization type:                  full
L1d cache:                            192 KiB
L1i cache:                            192 KiB
L2 cache:                             6 MiB
L3 cache:                             38.5 MiB
NUMA node0 CPU(s):                    0-11
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Mitigation; Enhanced IBRS
Vulnerability Spec rstack overflow:   Not affected
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Enhanced / Automatic IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves arat avx512_vnni md_clear arch_capabilities

Versions of relevant libraries:
[pip3] diffusers==0.29.2
[pip3] ltx-pytorchnvcodec==0.1.1
[pip3] mypy==1.9.0
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.26.4
[pip3] onnx==1.16.0
[pip3] onnxruntime==1.17.1
[pip3] onnxruntime-gpu==1.17.1
[pip3] open-clip-torch==2.24.0
[pip3] pytorch-lightning==2.2.1
[pip3] taming-transformers==0.0.1
[pip3] torch==2.1.2
[pip3] torchmetrics==1.3.2
[pip3] torchsde==0.2.6
[pip3] torchvision==0.16.2
[pip3] transformers==4.39.3
[pip3] triton==2.1.0
[conda] Could not collect

🐛 Describe the bug

(Copied from https://github.com/siliconflow/onediff/pull/1036) Error occurred when executing OneDiffCheckpointLoaderSimple:

name 'is_disable_oneflow_backend' is not defined

File "/home/qrcode/comfyui/ComfyUI/execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "/home/qrcode/comfyui/ComfyUI/execution.py", line 82, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "/home/qrcode/comfyui/ComfyUI/execution.py", line 75, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "/home/qrcode/comfyui/comfyui-env/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/home/qrcode/comfyui/ComfyUI/custom_nodes/onediff_comfy_nodes/_nodes.py", line 253, in onediff_load_checkpoint
vae = self.speedup(
File "/home/qrcode/comfyui/comfyui-env/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/home/qrcode/comfyui/ComfyUI/custom_nodes/onediff_comfy_nodes/_nodes.py", line 80, in speedup
return (booster(model, *args, **kwargs),)
File "/home/qrcode/comfyui/ComfyUI/custom_nodes/onediff_comfy_nodes/modules/booster_scheduler.py", line 61, in call
return self.compile(model=model, ckpt_name=ckpt_name, **kwargs)
File "/home/qrcode/comfyui/ComfyUI/custom_nodes/onediff_comfy_nodes/modules/booster_scheduler.py", line 24, in wrapper
self.cache_service.put(cached_model_key, cached_model)
File "/home/qrcode/comfyui/ComfyUI/custom_nodes/onediff_comfy_nodes/modules/booster_cache.py", line 72, in put
cached_model = get_cached_model(model)
File "/usr/lib/python3.10/functools.py", line 889, in wrapper
return dispatch(args[0].class)(*args, **kw)
File "/home/qrcode/comfyui/ComfyUI/custom_nodes/onediff_comfy_nodes/modules/booster_cache.py", line 55, in _
if is_oneflow_available() and not is_disable_oneflow_backend(): this is error message

from collections import OrderedDict
from functools import singledispatch

import torch
from comfy.model_patcher import ModelPatcher
from comfy.sd import VAE
from onediff.torch_utils.module_operations import get_sub_module
from onediff.utils.import_utils import is_oneflow_available this is code

Seems that from ._config import is_disable_oneflow_backend should be added here: https://github.com/siliconflow/onediff/blob/main/onediff_comfy_nodes/modules/booster_cache.py#L55

hashmap521 commented 3 months ago

i also have this bug

ccssu commented 3 months ago

Hello, 👏 Thanks for your feedback! The issue has been fixed, please update onediff. @hashmap521 @Ner1Co Refer to the installation guide document: https://github.com/siliconflow/onediff/tree/main/onediff_comfy_nodes#installation-guide