yangheng95 / PyABSA

Sentiment Analysis, Text Classification, Text Augmentation, Text Adversarial defense, etc.;
https://pyabsa.readthedocs.io
MIT License
900 stars 152 forks source link

Import Error when using on Google Colab #392

Open regantan opened 3 months ago

regantan commented 3 months ago

Version See the console output for PyABSA, Torch, Transformers Version The transformers version is 4.29.0, the torch version is 2.1.0+cu121 and the PyABSA version is 2.4.0.

Describe the bug A clear and concise description of what the bug is.

Import warnings of libraries causing google colab to crash

Code To Reproduce Paste buggy code here

!pip install pyabsa[dev] -U

importing the library for any usage will cause the error

Expected behavior A clear and concise description of what you expected to happen.

Expected to do simple inference on sentence

Screenshots If applicable, add screenshots to help explain your problem.

:914: ImportWarning: _PyDrive2ImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDriveImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _GenerativeAIImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _OpenCVImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: APICoreClientInfoImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _BokehImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _AltairImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDrive2ImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDriveImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _GenerativeAIImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _OpenCVImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: APICoreClientInfoImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _BokehImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _AltairImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDrive2ImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDriveImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _GenerativeAIImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _OpenCVImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: APICoreClientInfoImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _BokehImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _AltairImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDrive2ImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDriveImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _GenerativeAIImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _OpenCVImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: APICoreClientInfoImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _BokehImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _AltairImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDrive2ImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDriveImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _GenerativeAIImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _OpenCVImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: APICoreClientInfoImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _BokehImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _AltairImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDrive2ImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDriveImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _GenerativeAIImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _OpenCVImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: APICoreClientInfoImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _BokehImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _AltairImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDrive2ImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDriveImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _GenerativeAIImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _OpenCVImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: APICoreClientInfoImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _BokehImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _AltairImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDrive2ImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDriveImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _GenerativeAIImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _OpenCVImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: APICoreClientInfoImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _BokehImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _AltairImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDrive2ImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDriveImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _GenerativeAIImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _OpenCVImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: APICoreClientInfoImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _BokehImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _AltairImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDrive2ImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDriveImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _GenerativeAIImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _OpenCVImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: APICoreClientInfoImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _BokehImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _AltairImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDrive2ImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDriveImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _GenerativeAIImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _OpenCVImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: APICoreClientInfoImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _BokehImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _AltairImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDrive2ImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDriveImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _GenerativeAIImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _OpenCVImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: APICoreClientInfoImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _BokehImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _AltairImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDrive2ImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDriveImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _GenerativeAIImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _OpenCVImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: APICoreClientInfoImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _BokehImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _AltairImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDrive2ImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDriveImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _GenerativeAIImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _OpenCVImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: APICoreClientInfoImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _BokehImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _AltairImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDrive2ImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDriveImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _GenerativeAIImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _OpenCVImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: APICoreClientInfoImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _BokehImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _AltairImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDrive2ImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDriveImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _GenerativeAIImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _OpenCVImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: APICoreClientInfoImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _BokehImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _AltairImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDrive2ImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _PyDriveImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _GenerativeAIImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _OpenCVImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: APICoreClientInfoImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _BokehImportHook.find_spec() not found; falling back to find_module() :914: ImportWarning: _AltairImportHook.find_spec() not found; falling back to find_module() [2024-01-11 13:01:34] (2.3.4) PyABSA(2.3.4): If your code crashes on Colab, please use the GPU runtime. Then run "pip install pyabsa[dev] -U" and restart the kernel. Or if it does not work, you can use v1.x versions, e.g., pip install pyabsa<2.0 -U

WARNING: When you fails to load a checkpoint, e.g., Unexpected key(s), Try to downgrade transformers<=4.29.0.

yangheng95 commented 3 months ago

This is a known issue about colab, however, the reason for why it happens is still unknown. Have you try the instruction:

[2024-01-11 13:01:34] (2.3.4) PyABSA(2.3.4): If your code crashes on Colab, please use the GPU runtime. Then run "pip install pyabsa[dev] -U" and restart the kernel.
Or if it does not work, you can use v1.x versions, e.g., pip install pyabsa<2.0 -U