Skip to content

Failed to import diffusers.schedulers.scheduling_ddim because of the following error (look up to see its traceback): numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject #11169

@FurkanGozukara

Description

@FurkanGozukara

Describe the bug

Google Colab upgraded to Python 3.11 and now this basic code fails. I don't get why

Reproduction

import torch
from diffusers import StableDiffusionPipeline

# Path to your trained model
model_path = '/content/stable_diffusion_weights/ohwx/800'  # Update if needed

pipe = StableDiffusionPipeline.from_pretrained(
    "/content/stable_diffusion_weights/ohwx/800",
    torch_dtype=torch.float16,
        safety_checker=None,
)


 
prompt = "a photo of an astronaut riding a horse on mars"
pipe.enable_attention_slicing()
image = pipe(prompt).images[0]

Logs

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/usr/local/lib/python3.11/dist-packages/diffusers/utils/import_utils.py in _get_module(self, module_name)
    717         try:
--> 718             return importlib.import_module("." + module_name, self.__name__)
    719         except Exception as e:

45 frames
numpy/random/mtrand.pyx in init numpy.random.mtrand()

ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

The above exception was the direct cause of the following exception:

RuntimeError                              Traceback (most recent call last)
RuntimeError: Failed to import diffusers.schedulers.scheduling_ddim because of the following error (look up to see its traceback):
numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

The above exception was the direct cause of the following exception:

RuntimeError                              Traceback (most recent call last)
RuntimeError: Failed to import diffusers.loaders.single_file because of the following error (look up to see its traceback):
Failed to import diffusers.schedulers.scheduling_ddim because of the following error (look up to see its traceback):
numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

The above exception was the direct cause of the following exception:

RuntimeError                              Traceback (most recent call last)
/usr/local/lib/python3.11/dist-packages/diffusers/utils/import_utils.py in _get_module(self, module_name)
    718             return importlib.import_module("." + module_name, self.__name__)
    719         except Exception as e:
--> 720             raise RuntimeError(
    721                 f"Failed to import {self.__name__}.{module_name} because of the following error (look up to see its"
    722                 f" traceback):\n{e}"

RuntimeError: Failed to import diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion because of the following error (look up to see its traceback):
Failed to import diffusers.loaders.single_file because of the following error (look up to see its traceback):
Failed to import diffusers.schedulers.scheduling_ddim because of the following error (look up to see its traceback):
numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

System Info

Copy-and-paste the text below in your GitHub issue and FILL OUT the two last points.

  • diffusers version: 0.27.0
  • Platform: Linux-6.1.85+-x86_64-with-glibc2.35
  • Python version: 3.11.11
  • PyTorch version (GPU?): 2.2.0+cu121 (True)
  • Huggingface_hub version: 0.25.2
  • Transformers version: 4.43.0
  • Accelerate version: 1.5.2
  • xFormers version: 0.0.24
  • Using GPU in script?:
  • Using distributed or parallel set-up in script?:

Who can help?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions