siliconflow / onediff

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

[Bug] Nexfort isn't compatible with PyTorch 2.4.0 #1068

Open mrrfr opened 1 month ago

mrrfr commented 1 month ago

Your current environment information

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

OneFlow version: none Nexfort version: none OneDiff version: 1.2.1.dev12+g4bf583b5 OneDiffX version: 1.2.1.dev12+g4bf583b5

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: version 3.26.4 Libc version: glibc-2.35

Python version: 3.10.13 (main, Sep 11 2023, 13:44:35) [GCC 11.2.0] (64-bit runtime) Python platform: Linux-5.15.0-94-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 A100-SXM4-40GB Nvidia driver version: 535.154.05 cuDNN version: Probably one of the following: /usr/lib/x86_64-linux-gnu/libcudnn.so.8.9.0 /usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.9.0 /usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.9.0 /usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.9.0 /usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.9.0 /usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.9.0 /usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.9.0 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: 1 Core(s) per socket: 32 Socket(s): 2 Stepping: 0 Frequency boost: enabled CPU max MHz: 2400.0000 CPU min MHz: 1500.0000 BogoMIPS: 4800.29 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 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: 2 MiB (64 instances) L1i cache: 2 MiB (64 instances) L2 cache: 32 MiB (64 instances) L3 cache: 512 MiB (32 instances) NUMA node(s): 2 NUMA node0 CPU(s): 0-31 NUMA node1 CPU(s): 32-63 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: Not affected Vulnerability Retbleed: Mitigation; untrained return thunk; SMT disabled Vulnerability Spec rstack overflow: Mitigation; SMT disabled 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 disabled, RSB filling, PBRSB-eIBRS Not affected Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Not affected

Versions of relevant libraries: [pip3] diffusers==0.30.0.dev0 [pip3] numpy==1.26.3 [pip3] optree==0.10.0 [pip3] torch==2.4.0 [pip3] torchao==0.1 [pip3] torchaudio==2.4.0 [pip3] torchelastic==0.2.2 [pip3] torchvision==0.19.0 [pip3] transformers==4.43.4 [pip3] triton==3.0.0 [conda] blas 1.0 mkl
[conda] ffmpeg 4.3 hf484d3e_0 pytorch [conda] libjpeg-turbo 2.0.0 h9bf148f_0 pytorch [conda] mkl 2023.1.0 h213fc3f_46344
[conda] mkl-service 2.4.0 py310h5eee18b_1
[conda] mkl_fft 1.3.8 py310h5eee18b_0
[conda] mkl_random 1.2.4 py310hdb19cb5_0
[conda] numpy 1.26.3 py310h5f9d8c6_0
[conda] numpy-base 1.26.3 py310hb5e798b_0
[conda] optree 0.10.0 pypi_0 pypi [conda] pytorch-cuda 12.1 ha16c6d3_5 pytorch [conda] pytorch-mutex 1.0 cuda pytorch [conda] torch 2.4.0 pypi_0 pypi [conda] torchao 0.1 pypi_0 pypi [conda] torchaudio 2.4.0 pypi_0 pypi [conda] torchelastic 0.2.2 pypi_0 pypi [conda] torchvision 0.19.0 pypi_0 pypi [conda] triton 3.0.0 pypi_0 pypi

🐛 Describe the bug

I tried to execute Flux diffusers pipeline with Nexfort backend and Onediff and i have this error:

Unable to load nexfort.{extension} module. Is it compatible with your PyTorch installation?
Traceback (most recent call last):
  File "/workspace/main.py", line 164, in <module>
    main()
  File "/workspace/main.py", line 134, in main
    flux = FluxGenerator(args.model, compilerconfig, quantizeconfig)
  File "/workspace/main.py", line 87, in init
    self.pipe = self.compile_pipe(self.pipe, compiler_config)
  File "/workspace/main.py", line 120, in compile_pipe
    pipe.transformer = compile(pipe.transformer, backend="nexfort", options=options)
  File "/workspace/onediff/src/onediff/infer_compiler/backends/compiler.py", line 16, in compile
    model = backend(torch_module, options=options)
  File "/workspace/onediff/src/onediff/infer_compiler/backends/nexfort/nexfort.py", line 11, in compile
    from nexfort.compilers import nexfort_compile
  File "/opt/conda/lib/python3.10/site-packages/nexfort/__init.py", line 22, in <module>
    exec(f"import nexfort.{extension} as {extension}")
  File "<string>", line 1, in <module>
ImportError: /opt/conda/lib/python3.10/site-packages/nexfort/_C_inductor.cpython-310-x86_64-linux-gnu.so: undefined symbol: _ZN5torch3jit11parseSchemaERKSs

I have installed Nexfort with pip install -U nexfort

strint commented 1 month ago

Nexfort version: none

This is not as expected.

https://pypi.org/project/nexfort/#history

it should be 0.1.dev261

mrrfr commented 1 month ago

Yes but when i retry (after upgrading torch & torchvision version) to pip install -U nexfort it seems to be good.

Here's the output, Did i miss something ?


Requirement already satisfied: nexfort in /opt/conda/lib/python3.10/site-packages (0.1.dev261)
Requirement already satisfied: packaging in /opt/conda/lib/python3.10/site-packages (from nexfort) (23.1)
Requirement already satisfied: torch in /opt/conda/lib/python3.10/site-packages (from nexfort) (2.4.0)
Requirement already satisfied: filelock in /opt/conda/lib/python3.10/site-packages (from torch->nexfort) (3.13.1)
Requirement already satisfied: typing-extensions>=4.8.0 in /opt/conda/lib/python3.10/site-packages (from torch->nexfort) (4.9.0)
Requirement already satisfied: sympy in /opt/conda/lib/python3.10/site-packages (from torch->nexfort) (1.12)
Requirement already satisfied: networkx in /opt/conda/lib/python3.10/site-packages (from torch->nexfort) (3.1)
Requirement already satisfied: jinja2 in /opt/conda/lib/python3.10/site-packages (from torch->nexfort) (3.1.2)
Requirement already satisfied: fsspec in /opt/conda/lib/python3.10/site-packages (from torch->nexfort) (2023.12.2)
Requirement already satisfied: nvidia-cuda-nvrtc-cu12==12.1.105 in /opt/conda/lib/python3.10/site-packages (from torch->nexfort) (12.1.105)
Requirement already satisfied: nvidia-cuda-runtime-cu12==12.1.105 in /opt/conda/lib/python3.10/site-packages (from torch->nexfort) (12.1.105)
Requirement already satisfied: nvidia-cuda-cupti-cu12==12.1.105 in /opt/conda/lib/python3.10/site-packages (from torch->nexfort) (12.1.105)
Requirement already satisfied: nvidia-cudnn-cu12==9.1.0.70 in /opt/conda/lib/python3.10/site-packages (from torch->nexfort) (9.1.0.70)
Requirement already satisfied: nvidia-cublas-cu12==12.1.3.1 in /opt/conda/lib/python3.10/site-packages (from torch->nexfort) (12.1.3.1)
Requirement already satisfied: nvidia-cufft-cu12==11.0.2.54 in /opt/conda/lib/python3.10/site-packages (from torch->nexfort) (11.0.2.54)
Requirement already satisfied: nvidia-curand-cu12==10.3.2.106 in /opt/conda/lib/python3.10/site-packages (from torch->nexfort) (10.3.2.106)
Requirement already satisfied: nvidia-cusolver-cu12==11.4.5.107 in /opt/conda/lib/python3.10/site-packages (from torch->nexfort) (11.4.5.107)
Requirement already satisfied: nvidia-cusparse-cu12==12.1.0.106 in /opt/conda/lib/python3.10/site-packages (from torch->nexfort) (12.1.0.106)
Requirement already satisfied: nvidia-nccl-cu12==2.20.5 in /opt/conda/lib/python3.10/site-packages (from torch->nexfort) (2.20.5)
Requirement already satisfied: nvidia-nvtx-cu12==12.1.105 in /opt/conda/lib/python3.10/site-packages (from torch->nexfort) (12.1.105)
Requirement already satisfied: triton==3.0.0 in /opt/conda/lib/python3.10/site-packages (from torch->nexfort) (3.0.0)
Requirement already satisfied: nvidia-nvjitlink-cu12 in /opt/conda/lib/python3.10/site-packages (from nvidia-cusolver-cu12==11.4.5.107->torch->nexfort) (12.6.20)
Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.10/site-packages (from jinja2->torch->nexfort) (2.1.3)
Requirement already satisfied: mpmath>=0.19 in /opt/conda/lib/python3.10/site-packages (from sympy->torch->nexfort) (1.3.0)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv```
strint commented 1 month ago

A friend had the same problem, and he fixed this with torch 2.3.0

We will see the torch 2.4.0 problem later(torch 2.4.0 works in my env).

mrrfr commented 1 month ago

Ok thank you :)

Swarzox commented 1 month ago

A friend had the same problem, and he fixed this with torch 2.3.0

We will see the torch 2.4.0 problem later(torch 2.4.0 works in my env).

Could you please share your env so we can use onediff with torch 2.4.0

Azru44 commented 1 month ago

Ok thank you :)

did you find anything ? We are facing the same issue

mrrfr commented 1 month ago

Ok thank you :)

did you find anything ? We are facing the same issue

Unfortunately, no. I saw that a new version of nexfort was released but it seems like it didn't work with pytorch 2.4.

Swarzox commented 4 weeks ago

any update?

strint commented 3 weeks ago

Since pytorch 2.4 is released, nexfort package has been update to pytorch 2.4.0 and cuda 12.1: https://pypi.org/project/nexfort/

@Swarzox @mrrfr @Azru44