georgian-io / Multimodal-Toolkit

Multimodal model for text and tabular data with HuggingFace transformers as building block for text data
https://multimodal-toolkit.readthedocs.io
Apache License 2.0
587 stars 84 forks source link

Unable to run notebook examples #49

Closed levente-murgas closed 1 year ago

levente-murgas commented 1 year ago

Describe the bug When trying to run any of the 2 shared notebooks in the repository the execution fails during imports.

The error message being the same both cases:

RuntimeError                              Traceback (most recent call last)
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe
RuntimeError                              Traceback (most recent call last)
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe
ImportError                               Traceback (most recent call last)
ImportError: numpy.core._multiarray_umath failed to import
ImportError                               Traceback (most recent call last)
ImportError: numpy.core.umath failed to import
RuntimeError                              Traceback (most recent call last)
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe
ImportError                               Traceback (most recent call last)
ImportError: numpy.core._multiarray_umath failed to import
ImportError                               Traceback (most recent call last)
ImportError: numpy.core.umath failed to import
RuntimeError                              Traceback (most recent call last)
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe
ImportError                               Traceback (most recent call last)
ImportError: numpy.core._multiarray_umath failed to import
ImportError                               Traceback (most recent call last)
ImportError: numpy.core.umath failed to import
TypeError                                 Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/transformers/utils/import_utils.py in _get_module(self, module_name)
   1145         try:
-> 1146             return importlib.import_module("." + module_name, self.__name__)
   1147         except Exception as e:

27 frames
TypeError: Unable to convert function return value to a Python type! The signature was
    () -> handle

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

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

RuntimeError: Failed to import transformers.trainer because of the following error (look up to see its traceback):
Unable to convert function return value to a Python type! The signature was
    () -> handle

When installing the module I also receive an error from pip. Maybe this leads to the error occurring during module imports: ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. arviz 0.15.1 requires scipy>=1.8.0, but you have scipy 1.7.3 which is incompatible. google-colab 1.0.0 requires pandas==1.5.3, but you have pandas 1.3.5 which is incompatible. tensorflow 2.12.0 requires numpy<1.24,>=1.22, but you have numpy 1.21.6 which is incompatible.

To Reproduce Steps to reproduce the behavior:

  1. Copy example notebook from this repository.
  2. Run cell containing !pip install multimodal-transformers
  3. Run cell at section "All other imports are here:"
  4. See error

Expected behavior The modules should be imported successfully.

Desktop:

akashsaravanan-georgian commented 1 year ago

Hi @levente-murgas, just to clarify - do you receive this error when you try to run notebooks/text_w_tabular_classification.ipynb on a Google Colab instance? I'm asking this since the error message mentions tensorflow but this library is built with PyTorch.

levente-murgas commented 1 year ago

Hi @akashsaravanan-georgian,

I think the issue is coming from that Colab notebooks automatically come with preinstalled libraries, amongst them also TensorFlow. I couldn't find a way to practically run the notebook in Colab unfortunately. But this is just an environmental issue as if I ran the notebook in my local environment it works.

akashsaravanan-georgian commented 1 year ago

Ah I see, I didn't know that. I'm guessing trying to uninstall tensorflow didn't help then?

akashsaravanan-georgian commented 1 year ago

I'm closing this issue as it seems to be an issue with Colab rather than the library. Please feel free to open it up again if this isn't the case.