siliconflow / onediff

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

onediffx compile_pipe error: 'NoneType' object has no attribute 'remove' #666

Closed West2022 closed 1 week ago

West2022 commented 5 months ago

when use onediffx with the following code,

################################ import torch from diffusers import StableDiffusionXLPipeline

from onediffx import compile_pipe

pipe = StableDiffusionXLPipeline.from_pretrained( "stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True ) pipe.to("cuda") pipe = compile_pipe(pipe) #################################

I got these error:

Loading pipeline components...: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████| 7/7 [00:18<00:00, 2.61s/it] Setting ds_accelerator to cuda (auto detect) WARNING [2024-02-23 07:28:52] /home/notebook/code/group/songxin/AIGC/onediff/src/onediff/infer_compiler/transform/custom_transform.py:49 - Failed to import register_diffusers from /home/notebook/code/group/songxin/AIGC/onediff/src/infer_compiler_registry/register_diffusers. e=RuntimeError('Failed to import diffusers.models.unet_2d_condition because of the following error (look up to see its traceback):\nFailed to import transformers.models.clip.modeling_clip because of the following error (look up to see its traceback):\nduplicate validator function "deepspeed.runtime.zero.offload_config.DeepSpeedZeroOffloadOptimizerConfig.set_pipeline"; if this is intended, set allow_reuse=True') WARNING [2024-02-23 07:28:52] /home/notebook/code/group/songxin/AIGC/onediff/src/onediff/infer_compiler/transform/custom_transform.py:49 - Failed to import register_diffusers from /home/notebook/code/group/songxin/AIGC/onediff/src/infer_compiler_registry/register_diffusers. e=RuntimeError('Failed to import diffusers.models.unet_2d_condition because of the following error (look up to see its traceback):\nFailed to import transformers.models.clip.modeling_clip because of the following error (look up to see its traceback):\nduplicate validator function "deepspeed.runtime.zero.offload_config.DeepSpeedZeroOffloadOptimizerConfig.set_pipeline"; if this is intended, set allow_reuse=True') WARNING [2024-02-23 07:28:52] /home/notebook/code/group/songxin/AIGC/onediff/src/onediff/infer_compiler/transform/custom_transform.py:49 - Failed to import register_diffusers from /home/notebook/code/group/songxin/AIGC/onediff/src/infer_compiler_registry/register_diffusers. e=RuntimeError('Failed to import diffusers.models.unet_2d_condition because of the following error (look up to see its traceback):\nFailed to import transformers.models.clip.modeling_clip because of the following error (look up to see its traceback):\nduplicate validator function "deepspeed.runtime.zero.offload_config.DeepSpeedZeroOffloadOptimizerConfig.set_pipeline"; if this is intended, set allow_reuse=True') WARNING [2024-02-23 07:28:52] /home/notebook/code/group/songxin/AIGC/onediff/src/onediff/infer_compiler/transform/custom_transform.py:49 - Failed to import register_diffusers from /home/notebook/code/group/songxin/AIGC/onediff/src/infer_compiler_registry/register_diffusers. e=RuntimeError('Failed to import diffusers.models.unet_2d_condition because of the following error (look up to see its traceback):\nFailed to import transformers.models.clip.modeling_clip because of the following error (look up to see its traceback):\nduplicate validator function "deepspeed.runtime.zero.offload_config.DeepSpeedZeroOffloadOptimizerConfig.set_pipeline"; if this is intended, set allow_reuse=True') WARNING [2024-02-23 07:28:52] /home/notebook/code/group/songxin/AIGC/onediff/src/onediff/infer_compiler/transform/custom_transform.py:49 - Failed to import register_diffusers from /home/notebook/code/group/songxin/AIGC/onediff/src/infer_compiler_registry/register_diffusers. e=RuntimeError('Failed to import diffusers.models.unet_2d_condition because of the following error (look up to see its traceback):\nFailed to import transformers.models.clip.modeling_clip because of the following error (look up to see its traceback):\nduplicate validator function "deepspeed.runtime.zero.offload_config.DeepSpeedZeroOffloadOptimizerConfig.set_pipeline"; if this is intended, set allow_reuse=True') Exception ignored in: <function Library.del at 0x7f05d967dcf0> Traceback (most recent call last): File "/opt/conda/lib/python3.10/site-packages/torch/library.py", line 136, in del AttributeError: 'NoneType' object has no attribute 'remove'

torch version: 2.0.1+cu118 diffuser version: 0.25.1 transformer version: 4.27.1

How can I fix these errors, thank you very much!

chengzeyi commented 4 months ago

@West2022 Please disable DeepSpeed.

West2022 commented 4 months ago

@West2022 Please disable DeepSpeed.

Thanks your reply extremely. But how to disable DeepSpeed?

strint commented 4 months ago

deepspeed.runtime.zero.offload_config.DeepSpeedZeroOffloadOptimizerConfig

pip list | grep deepspeed

to see whether DeepSpeed is installed

pip uninstall deepspeed

to uninstall deepspeed

@West2022

strint commented 4 months ago

@West2022 Any new progress?

strint commented 3 months ago

No new progress. Feel free to reopen.

joel-simon commented 2 months ago

I have this same issue, no deep speed installed.

diffusers 0.26.2 transformers 4.37.2

python examples/text_to_image.py Exception ignored in: <function Library.__del__ at 0x7f1d523d1670> Traceback (most recent call last): File "/opt/conda/envs/pytorch/lib/python3.9/site-packages/torch/library.py", line 139, in __del__ AttributeError: 'NoneType' object has no attribute 'remove'

joel-simon commented 2 months ago

Update, this error only happens when the scripts completes, so it is not blocking

strint commented 2 months ago

Update, this error only happens when the scripts completes, so it is not blocking

Thanks!

This looks like an object destruction problem. We will try to reproduce the problem.

cchen-reese commented 2 weeks ago

Has this issue been fixed? use oneflow_compile from onediff.infer_compiler /python3.8/site-packages/torch/library.py", line 136, in __del__ AttributeError: 'NoneType' object has no attribute 'remove'

strint commented 2 weeks ago

@cchen-reese Can you provide an example for it so we can reproduce this?

strint commented 1 week ago

too old to follow, please feel free to reopen it.