ai-toolkit icon indicating copy to clipboard operation
ai-toolkit copied to clipboard

cant run_job (numpy.dtype size changed)

Open TheOneWayTruth opened this issue 1 year ago • 3 comments

This is for bugs only

Did you already ask in the discord?

No

You verified that this is a bug and not a feature request or question by asking in the discord?

No

Describe the bug

Error description:

cant run the run_job(job_to_run)

ERROR LOG:


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

27 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) /usr/local/lib/python3.11/dist-packages/diffusers/utils/import_utils.py in _get_module(self, module_name) 943 return importlib.import_module("." + module_name, self.name) 944 except Exception as e: --> 945 raise RuntimeError( 946 f"Failed to import {self.name}.{module_name} because of the following error (look up to see its" 947 f" traceback):\n{e}"

RuntimeError: Failed to import diffusers.schedulers.scheduling_ddpm 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

more info

The script worked for me all the time, but something changed maybe some new version of numpy or something. (i am running the script on colab gogole pro version.

TheOneWayTruth avatar Mar 18 '25 23:03 TheOneWayTruth

I can confirm, I have the same problem

svetozarov avatar Mar 21 '25 18:03 svetozarov

Here is the solution to this error

When working in Colab, to create a temporary solution for a numpy version compatibility issue, you need to add an additional separate code block

import os
!pip install --quiet --force-reinstall --no-deps numpy==1.26.3
os.kill(os.getpid(), 9)

This code will downgrade numpy and also trigger a forced runtime restart so that the currently installed version of numpy is properly updated to an older, compatible one

After the automatic environment restart, everything works fine

svetozarov avatar Mar 22 '25 20:03 svetozarov

Here is the solution to this error

When working in Colab, to create a temporary solution for a numpy version compatibility issue, you need to add an additional separate code block

import os
!pip install --quiet --force-reinstall --no-deps numpy==1.26.3
os.kill(os.getpid(), 9)

This code will downgrade numpy and also trigger a forced runtime restart so that the currently installed version of numpy is properly updated to an older, compatible one

After the automatic environment restart, everything works fine

amazing solution ty

FurkanGozukara avatar May 05 '25 15:05 FurkanGozukara