Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name '_accumulate' from 'torch._utils' #416

Open
RobertLee0522 opened this issue May 2, 2024 · 1 comment
Open

Comments

@RobertLee0522
Copy link

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
@sugar6502
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants