sony / nnabla-examples

Neural Network Libraries https://nnabla.org/ - Examples
Apache License 2.0
306 stars 93 forks source link

ValueError: numpy.ndarray size changed #367

Closed I021259 closed 1 year ago

I021259 commented 1 year ago

Dear experts,

I've tried to execute the demo of StyleGAN2 on Google Colab according to the following link.

https://arxiv.org/abs/1912.04958

However, I've faced the following error in the step "Get the pretrained weights".

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

Do you have any idea how to solve the above error. Thank you very much for your kind support in advance.

Best regards,

TomonobuTsujikawa commented 1 year ago

Thank you for reporting this issue! Current Colab seems to have package dependency issue for protobuf and Pillow.

nnabla needs protobuf <=3.19.4, but googleapis needs protobuf >=3.19.5, and Pillow version is old. So, please add the following code after the section for installing nnabla-ext-cuda114 and cloning examples. (Maybe this is not minimum solution, but it could work on my colab environment.)

!pip install -U pip
!pip install -U protobuf==3.19.4
!pip install -U Pillow h5py contextlib2 imageio

Please note that you need to click "RESTART RUNTIME", and change directory to stylegan2 by %cd nnabla-examples/image-generation/stylegan2 again.

After that, you can install nnabla-ext-cuda114 and dependent packages correctly.

I021259 commented 1 year ago

Thank you very much for your quikc response! I've confirmed your proposed solution worked in my environment as well. Thanks a lot again :-)