Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

“ImportError: cannot import name 'OneFlowStableDiffusionPipeline' from 'diffusers'” ”TypeError: invalid dtype object: only floating-point types are supported as the default type” #110

Closed
Alokia opened this issue Feb 17, 2023 · 1 comment

Comments

@Alokia
Copy link

Alokia commented Feb 17, 2023

diffusers仓库更新,原tests样例几乎全部无法执行。

参照新样例 https://github.com/Oneflow-Inc/diffusers/blob/main/examples/text_to_image_sd2.py
https://github.com/Oneflow-Inc/diffusers/blob/oneflow-fork/tests/test_pipelines_oneflow_graph_load.py 中的导入方式从

from diffusers import (
    OneFlowStableDiffusionPipeline as StableDiffusionPipeline,
    OneFlowEulerDiscreteScheduler as EulerDiscreteScheduler,
)
from diffusers import utils

改为

from onediff import OneFlowStableDiffusionPipeline as StableDiffusionPipeline
from diffusers import EulerDiscreteScheduler

from diffusers import utils

后,执行报错

==> Try to run graph save...
==> function  get_pipe  try to run...
get_pipe  cuda mem before  2854.75  MB
get_pipe  host mem before  1729.0  MB
Fetching 12 files: 100%|████████████████████████████████████████████████████████████| 12/12 [00:00<00:00, 49490.31it/s]
<frozen importlib._bootstrap>:283: DeprecationWarning: the load_module() method is deprecated and slated for removal in Python 3.12; use exec_module() instead
E
======================================================================
ERROR: test_sd_graph_save_and_load (__main__.OneFlowPipeLineGraphSaveLoadTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/zhaodi/work/test.py", line 171, in test_sd_graph_save_and_load
    _test_sd_graph_save_and_load(True, f0 ,f1, f2)
  File "/home/zhaodi/work/test.py", line 76, in _test_sd_graph_save_and_load
    sch, pipe = get_pipe()
  File "/home/zhaodi/work/test.py", line 28, in new_fn
    out = fn(*args, **kwargs)
  File "/home/zhaodi/work/test.py", line 72, in get_pipe
    sd_pipe = StableDiffusionPipeline.from_pretrained(
  File "/home/zhaodi/miniconda3/lib/python3.10/site-packages/diffusers/pipelines/pipeline_utils.py", line 739, in from_pretrained
    loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)
  File "/home/zhaodi/miniconda3/lib/python3.10/site-packages/transformers/modeling_utils.py", line 2325, in from_pretrained
    dtype_orig = cls._set_default_torch_dtype(torch_dtype)
  File "/home/zhaodi/miniconda3/lib/python3.10/site-packages/transformers/modeling_utils.py", line 1109, in _set_default_torch_dtype
    torch.set_default_dtype(dtype)
  File "/home/zhaodi/miniconda3/lib/python3.10/site-packages/torch/__init__.py", line 395, in set_default_dtype
    _C._set_default_dtype(d)
TypeError: invalid dtype object: only floating-point types are supported as the default type

----------------------------------------------------------------------
Ran 1 test in 8.609s

Linux
diffusers 0.12.1
onediff 0.1.0 /home/zhaodi/onediff/src

@Alokia Alokia changed the title ”TypeError: invalid dtype object: only floating-point types are supported as the default type” “ImportError: cannot import name 'OneFlowStableDiffusionPipeline' from 'diffusers'” “ImportError: cannot import name 'OneFlowStableDiffusionPipeline' from 'diffusers'” ”TypeError: invalid dtype object: only floating-point types are supported as the default type” Feb 17, 2023
@jackalcooper
Copy link
Collaborator

please check out the new non-fork implementation, wiki has been update at https://github.com/Oneflow-Inc/diffusers/wiki/How-to-Run-OneFlow-Stable-Diffusion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants