deep-text-recognition-benchmark
deep-text-recognition-benchmark copied to clipboard
ImportError: cannot import name '_accumulate' from 'torch._utils'
python train.py --train_data data/train --valid_data data/val --select_data MJ-ST --batch_ratio 0.5-0.5 --Transformation None --FeatureExtraction VGG --SequenceModeling BiLSTM --Prediction CTC
Error message:
Traceback (most recent call last):
File "C:\Users\54-0461100-01\Desktop\img_process\easyocr_process\deep-text-recognition-benchmark\train.py", line 16, in <module>
from dataset import hierarchical_dataset, AlignCollate, Batch_Balanced_Dataset
File "C:\Users\54-0461100-01\Desktop\img_process\easyocr_process\deep-text-recognition-benchmark\dataset.py", line 13, in <module>
from torch._utils import _accumulate
ImportError: cannot import name '_accumulate' from 'torch._utils' (C:\Users\54-0461100-01\anaconda3\envs\easyocr\lib\site-packages\torch\_utils.py)
Environment details:
- 2.3.0+cu118
Hi, I think your version of pytorch is higher than requirement, so in this, the _accumulate is remove. My solution is changing from import name '_accumulate' from 'torch._utils' to from itertools import accumulate as _accumulate This work for me