AttributeError: module 'torchtext.data' has no attribute 'Iterator'
See original GitHub issueTraceback (most recent call last): File "train.py", line 5, in <module> from Process import * File "/Users/pycharm_pro/PyTorch_Learning/Transformer/Process.py", line 5, in <module> from Batch import MyIterator, batch_size_fn File "/Users/pycharm_pro/PyTorch_Learning/Transformer/Batch.py", line 35, in <module> class MyIterator(data.Iterator): AttributeError: module 'torchtext.data' has no attribute 'Iterator'
-
- torch 1.8.0
- torch-cluster 1.5.4
- torch-geometric 1.5.0
- torch-scatter 2.0.4
- torch-sparse 0.6.1
- torch-spline-conv 1.2.0
- torchtext 0.9.0
https://pytorch.org/text/stable/data_functional.html
i guess whether the torchtext.data’s api has changed ,but i don’t find right api
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
module 'torchtext.data' has no attribute 'Iterator' #1275 - GitHub
Yes, torchtext.data indeed have no attribute 'Iterator' in the latest release (https://github.com/pytorch/text/blob/release/0.9/torchtext ...
Read more >AttributeError: module 'torchtext.data' has no attribute 'Field'
From TorchText 0.9.0 Release Notes. torchtext.data.Field -> torchtext.legacy.data.Field This means, all features are still available, ...
Read more >module torchtext.data has no attribute field ( Solved )
Module torchtext.data has no attribute field error occurs because of internal directory structure change in torchtext in 0.9.0 version.
Read more >module 'torchtext.data' has no attribute 'field' - You.com
AttributeError : module 'torchtext.data' has no attribute 'Field' ·. · -> ·.legacy. ·. · This means, all features are still available, but within...
Read more >module 'torchtext.data' has no attribute 'Iterator' - Bountysource
Questions and Help. Description. class MyIterator(data.Iterator): def create_batches(self): if self.train: def pool(d, random_shuffler):
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You may try this : from torchtext.legacy import data instead of from torchtext import data.
Same problem for me. So I guess we need another Iterator.