huggingface / transformers

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
https://huggingface.co/transformers
Apache License 2.0
132.35k stars 26.36k forks source link

test_pytorch_examples.py: cannot import name 'preserve_channel_dim' from 'albucore.utils' #33650

Open dvrogozh opened 5 hours ago

dvrogozh commented 5 hours ago

Follow up from https://github.com/huggingface/transformers/pull/33485#issuecomment-2365429550. On https://github.com/huggingface/transformers/commit/78b2929c0554b79e0489b451ce4ece14d265ead2. Can't execute test_pytorch_examples.py due to the following error:

python3 -m pytest examples/pytorch/test_pytorch_examples.py
=================================================== test session starts ====================================================
platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.5.0
rootdir: /home/dvrogozh/git/huggingface/transformers
configfile: pyproject.toml
plugins: pspec-0.0.4, timeout-2.3.1, hypothesis-6.112.1, xdist-3.6.1, rich-0.1.1, dash-2.18.1, cov-5.0.0, typeguard-4.3.0
collected 0 items / 1 error

========================================================== ERRORS ==========================================================
________________________________ ERROR collecting examples/pytorch/test_pytorch_examples.py ________________________________
ImportError while importing test module '/home/dvrogozh/git/huggingface/transformers/examples/pytorch/test_pytorch_examples.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
examples/pytorch/test_pytorch_examples.py:64: in <module>
    import run_instance_segmentation
examples/pytorch/instance-segmentation/run_instance_segmentation.py:25: in <module>
    import albumentations as A
../../../pytorch.xpu/lib/python3.10/site-packages/albumentations/__init__.py:6: in <module>
    from .augmentations import *
../../../pytorch.xpu/lib/python3.10/site-packages/albumentations/augmentations/__init__.py:1: in <module>
    from .blur.functional import *
../../../pytorch.xpu/lib/python3.10/site-packages/albumentations/augmentations/blur/__init__.py:1: in <module>
    from .functional import *
../../../pytorch.xpu/lib/python3.10/site-packages/albumentations/augmentations/blur/functional.py:9: in <module>
    from albucore.utils import clipped, maybe_process_in_chunks, preserve_channel_dim
E   ImportError: cannot import name 'preserve_channel_dim' from 'albucore.utils' (/home/dvrogozh/pytorch.xpu/lib/python3.10/site-packages/albucore/utils.py)
----------------------------------------------------- Captured stderr ------------------------------------------------------
2024-09-21 19:49:32.549825: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2024-09-21 19:49:32.552029: I external/local_tsl/tsl/cuda/cudart_stub.cc:31] Could not find cuda drivers on your machine, GPU will not be used.
2024-09-21 19:49:32.581133: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2024-09-21 19:49:32.581162: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2024-09-21 19:49:32.582216: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2024-09-21 19:49:32.588529: I external/local_tsl/tsl/cuda/cudart_stub.cc:31] Could not find cuda drivers on your machine, GPU will not be used.
2024-09-21 19:49:32.589056: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX512F AVX512_VNNI AVX512_BF16 AVX_VNNI AMX_TILE AMX_INT8 AMX_BF16 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-09-21 19:49:33.234004: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)
================================================= short test summary info ==================================================
ERROR examples/pytorch/test_pytorch_examples.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
===================================================== 1 error in 0.84s =====================================================

CC: @amyeroberts

vasqu commented 5 hours ago

Needs to change dependency in the requirements.txt, apparently it needs albucore==0.0.16 based on https://github.com/ostris/ai-toolkit/issues/182#issuecomment-2364992905 👀