Description
Your current environment information
PyTorch version: 2.2.0+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A
OneFlow version: path: ['/usr/local/lib/python3.10/dist-packages/oneflow'], version: 0.9.1.dev20240803+cu121, git_commit: d23c061, cmake_build_type: Release, rdma: True, mlir: True, enterprise: False
Nexfort version: none
OneDiff version: 1.2.1.dev26
OneDiffX version: 1.2.0
OS: Ubuntu 22.04.3 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35
Python version: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (64-bit runtime)
Python platform: Linux-5.15.0-78-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 12.1.105
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 4090
Nvidia driver version: 535.161.07
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
Address sizes: 43 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 64
On-line CPU(s) list: 0-63
Vendor ID: AuthenticAMD
Model name: AMD EPYC 7532 32-Core Processor
CPU family: 23
Model: 49
Thread(s) per core: 2
Core(s) per socket: 32
Socket(s): 1
Stepping: 0
Frequency boost: enabled
CPU max MHz: 2400.0000
CPU min MHz: 1500.0000
BogoMIPS: 4800.12
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip rdpid overflow_recov succor smca sme sev sev_es
Virtualization: AMD-V
L1d cache: 1 MiB (32 instances)
L1i cache: 1 MiB (32 instances)
L2 cache: 16 MiB (32 instances)
L3 cache: 256 MiB (16 instances)
NUMA node(s): 1
NUMA node0 CPU(s): 0-63
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Retbleed: Mitigation; untrained return thunk; SMT enabled with STIBP protection
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; Retpolines, IBPB conditional, STIBP always-on, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected
Versions of relevant libraries:
[pip3] diffusers==0.29.2
[pip3] numpy==1.26.3
[pip3] torch==2.2.0
[pip3] torchaudio==2.2.0
[pip3] torchvision==0.17.0
[pip3] transformers==4.46.1
[pip3] triton==2.2.0
[conda] Could not collect
🐛 Describe the bug
I am trying to compile a sd1.5 InstructPix2Pix pipeline following the example here, https://github.com/siliconflow/onediff/blob/main/onediff_diffusers_extensions/examples/pipe_compile_save_load.py.
However, the load pipe triggers an error AttributeError: 'CLIPTextModel' object has no attribute 'load_graph'
.
Minimal code example as follows:
import torch
from diffusers import (
StableDiffusionInstructPix2PixPipeline,
)
from PIL import Image
from onediffx import compile_pipe, load_pipe, save_pipe
base = StableDiffusionInstructPix2PixPipeline.from_pretrained(
"timbrooks/instruct-pix2pix",
torch_dtype=torch.float16,
variant="fp16",
)
base.to("cuda")
input_image = Image.open("/example.png").convert("RGB").resize((512,512))
image = base(
prompt="Make the cup red",
image=input_image,
num_inference_steps=30,
image_guidance_scale=1.5,
guidance_scale=7.5,
).images[0]
base = compile_pipe(base)
save_pipe(base, dir="/workspace/cached_pipe")
loaded_pipeline = StableDiffusionInstructPix2PixPipeline.from_pretrained(
"timbrooks/instruct-pix2pix",
torch_dtype=torch.float16,
variant="fp16",
)
loaded_pipeline.to("cuda")
load_pipe(loaded_pipeline, dir="/workspace/cached_pipe")
The error trace is as follows:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[9], line 12
6 pipeline = StableDiffusionInstructPix2PixPipeline.from_pretrained(
7 "timbrooks/instruct-pix2pix",
8 torch_dtype=torch.float16,
9 variant="fp16",
10 )
11 pipeline.to("cuda")
---> 12 load_pipe(pipeline, dir="[/workspace/cached_pipe](/workspace/workspace/cached_pipe)")
File [/usr/local/lib/python3.10/dist-packages/onediffx/compilers/diffusion_pipeline_compiler.py:180](/workspace/usr/local/lib/python3.10/dist-packages/onediffx/compilers/diffusion_pipeline_compiler.py#line=179), in load_pipe(pipe, dir, ignores)
178 if obj is not None and os.path.exists(os.path.join(dir, part)):
179 logger.info(f"Loading {part}")
--> 180 obj.load_graph(os.path.join(dir, part))
182 if "image_processor" not in ignores:
183 logger.info("Patching image_processor")
File [/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py:1688](/workspace/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py#line=1687), in Module.__getattr__(self, name)
1686 if name in modules:
1687 return modules[name]
-> 1688 raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'CLIPTextModel' object has no attribute 'load_graph'