siliconflow/onediff

[Bug] TypeError: scaled_dot_product_attention(): argument 'query' (position 1) must be Tensor, not Tensor

hnlslyp opened this issue · 1 comments

Your current environment information

Unable to load nexfort.{extension} module. Is it compatible with your PyTorch installation?
Collecting environment information...
PyTorch version: 2.3.0+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A

OneFlow version: path: ['/root/miniconda3/envs/py310/lib/python3.10/site-packages/oneflow'], version: 0.9.1.dev20240903+cu122, git_commit: d23c061, cmake_build_type: Release, rdma: True, mlir: True, enterprise: False
Nexfort version: none
OneDiff version: 1.2.1.dev22+ga3cc989
OneDiffX version: 1.2.1.dev22+ga3cc989

OS: CentOS Linux 7 (Core) (x86_64)
GCC version: (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Clang version: Could not collect
CMake version: version 3.30.3
Libc version: glibc-2.17

Python version: 3.10.14 (main, May 6 2024, 19:42:50) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.10.0-1.0.0.34-x86_64-with-glibc2.17
Is CUDA available: True
CUDA runtime version: 10.1.105
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration:
GPU 0: NVIDIA L20
GPU 1: NVIDIA L20
GPU 2: NVIDIA L20
GPU 3: NVIDIA L20

Nvidia driver version: 535.154.05
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
CPU(s): 128
On-line CPU(s) list: 0-127
Thread(s) per core: 2
Core(s) per socket: 32
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 106
Model name: Intel(R) Xeon(R) Platinum 8350C CPU @ 2.60GHz
Stepping: 6
CPU MHz: 3100.000
CPU max MHz: 3500.0000
CPU min MHz: 800.0000
BogoMIPS: 5200.00
Virtualization: VT-x
L1d cache: 48K
L1i cache: 32K
L2 cache: 1280K
L3 cache: 49152K
NUMA node0 CPU(s): 0-31,64-95
NUMA node1 CPU(s): 32-63,96-127
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect wbnoinvd dtherm ida arat pln pts avx512vbmi umip pku avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq rdpid fsrm md_clear pconfig flush_l1d arch_capabilities

Versions of relevant libraries:
[pip3] diffusers==0.30.2
[pip3] numpy==1.26.4
[pip3] onnxruntime==1.16.3
[pip3] pytorch-triton==3.0.0+dedb7bdf33
[pip3] torch==2.3.0+cu121
[pip3] torchao==0.1
[pip3] torchaudio==2.3.0+cu121
[pip3] torchsde==0.2.6
[pip3] torchvision==0.18.0+cu121
[pip3] transformers==4.44.2
[pip3] triton==2.3.0
[conda] numpy 1.26.4 pypi_0 pypi
[conda] pytorch-triton 3.0.0+dedb7bdf33 pypi_0 pypi
[conda] torch 2.3.0+cu121 pypi_0 pypi
[conda] torchao 0.1 pypi_0 pypi
[conda] torchaudio 2.3.0+cu121 pypi_0 pypi
[conda] torchsde 0.2.6 pypi_0 pypi
[conda] torchvision 0.18.0+cu121 pypi_0 pypi
[conda] triton 2.3.0 pypi_0 pypi

🐛 Describe the bug

import oneflow as flow
#from onediff.infer_compiler import oneflow_compile
from onediff.schedulers import EulerDiscreteScheduler
from onediffx import compile_pipe
OUTPUT_TYPE = "pil"

base = "stabilityai/stable-diffusion-xl-base-1.0"
repo = "ByteDance/SDXL-Lightning"
base_model_id = "stabilityai/sdxlOriginV11Mix_sdxlOriginV11_fp16fix.safetensors"
ckpt = "stabilityai/sdxlOriginV11Mix_sdxlOriginV11Mix.safetensors"
pipe = StableDiffusionXLPipeline.from_single_file(ckpt, original_config_file='./sd_xl_base.yaml', torch_dtype=torch.float16).to("cuda")
pipe = compile_pipe(pipe)
prompt = "anime++. (solo), (1people),Medium shot, from a side angle, a little boy lies prone on the floor, toy in hand, gazing ahead with a relaxed expression. The background reveals an empty room, books and stationery scattered in a corner.. modern,male,children,Thin and thin,(Inch Head),(black hair),(black eyes),(Bright eyes, cute face round face),(Blue T-shirt, khaki shorts)1.1, . "
negative_prompt = "white background, clear background, animal, (animal ear)nsfw, naked, sexy, (bad hands)1.3, (extra hands)1.2, (extra fingers)1.2,(fused fingers)1.2,(missing fingers), unaestheticXL_hk1, negativeXL_D, FastNegative, unaestheticXL_Sky3.1, unaestheticXLv1, japan, japanese, kimono, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit,fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark,username, blurry, (national flag), (the Stars and the Stripes),(American flag), photorealistic, deformed,3d model,bad body, worst, ugly, realism, disfigured,text, deformity, bad legs, extra fingers,extra limbs, extra arms,extra legs,malformed limbs, fused fingers,too many fingers,long neck', 'eng_profile': 'modern,male,children,Thin and thin,(Inch Head),(black hair),(black eyes),(Bright eyes, cute face round face),(Blue T-shirt, khaki shorts)1.1, "
time_arr = []
for i in range(0, 50):
    stime = time.time()
    image = pipe(prompt, negative_prompt= negative_prompt, num_inference_steps=20, width=1024, height=1024, output_type=OUTPUT_TYPE).images[0]
    etime = time.time()
    timedelta = etime - stime
    image.save("static/onediff_sdxl/test_{}.png".format(i))
    time_arr.append(timedelta)
sati_time(time_arr)

把diffusers降到 0.29.2 已解决