ImportError: cannot import name 'TorchDispatchMode' from 'torch.utils._python_dispatch'
Thank you for your sharing! when I followed the instruction to try this project and evalution on ImageNet -1k, It showed this error: ImportError: cannot import name 'TorchDispatchMode' from 'torch.utils._python_dispatch', My conda list is as below:
Name Version Build Channel
_libgcc_mutex 0.1 main
_openmp_mutex 5.1 1_gnu
ca-certificates 2024.3.11 h06a4308_0
ld_impl_linux-64 2.38 h1181459_1
libffi 3.4.4 h6a678d5_1
libgcc-ng 11.2.0 h1234567_1
libgomp 11.2.0 h1234567_1
libstdcxx-ng 11.2.0 h1234567_1
ncurses 6.4 h6a678d5_0
numpy 1.24.1 pypi_0 pypi
opencv-python 4.4.0.46 pypi_0 pypi
openssl 3.0.13 h7f8727e_2
pillow 10.2.0 pypi_0 pypi
pip 24.0 py38h06a4308_0
ptflops 0.7.3 pypi_0 pypi
python 3.8.19 h955ad1f_0
pyyaml 6.0.1 pypi_0 pypi
readline 8.2 h5eee18b_0
scipy 1.10.1 pypi_0 pypi
setuptools 69.5.1 py38h06a4308_0
sqlite 3.45.3 h5eee18b_0
termcolor 1.1.0 pypi_0 pypi
thop 0.1.1-2209072238 pypi_0 pypi
timm 0.4.12 pypi_0 pypi
tk 8.6.14 h39e8969_0
torch 1.10.0+cu113 pypi_0 pypi
torchaudio 0.10.0+cu113 pypi_0 pypi
torchvision 0.11.1+cu113 pypi_0 pypi
typing-extensions 4.9.0 pypi_0 pypi
wheel 0.43.0 py38h06a4308_0
xz 5.4.6 h5eee18b_1
yacs 0.1.8 pypi_0 pypi
zlib 1.2.13 h5eee18b_1
hi, i find you can solve this problem by upgrading torch versin, for example, i upgrade with pip install torch==1.12.1+cu116 torchvision==0.13.1+cu116 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu116