NameError: name 'IterableWrapper' is not defined
See original GitHub issue🐛 Bug
Hello, I am trying to load torchtext datasets to reproduce a couple of the tutorials using the new PyTorch MPS support on Mac. After downloading torchdata I get the following error when trying to load any of the datasets in torchtext.datasets
:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Input In [51], in <cell line: 1>()
----> 1 data = torchtext.datasets.IMDB(
2 '~/data',
3 split='train'
4 )
File ~/opt/anaconda3/envs/main/lib/python3.10/site-packages/torchtext/data/datasets_utils.py:193, in _create_dataset_directory.<locals>.decorator.<locals>.wrapper(root, *args, **kwargs)
191 if not os.path.exists(new_root):
192 os.makedirs(new_root, exist_ok=True)
--> 193 return fn(root=new_root, *args, **kwargs)
File ~/opt/anaconda3/envs/main/lib/python3.10/site-packages/torchtext/data/datasets_utils.py:155, in _wrap_split_argument_with_fn.<locals>.new_fn(root, split, **kwargs)
153 result = []
154 for item in _check_default_set(split, splits, fn.__name__):
--> 155 result.append(fn(root, item, **kwargs))
156 return _wrap_datasets(tuple(result), split)
File ~/opt/anaconda3/envs/main/lib/python3.10/site-packages/torchtext/datasets/imdb.py:86, in IMDB(root, split)
81 if not is_module_available("torchdata"):
82 raise ModuleNotFoundError(
83 "Package `torchdata` not found. Please install following instructions at `https://github.com/pytorch/data`"
84 )
---> 86 url_dp = IterableWrapper([URL])
88 cache_compressed_dp = url_dp.on_disk_cache(
89 filepath_fn=partial(_filepath_fn, root),
90 hash_dict={_filepath_fn(root): MD5},
91 hash_type="md5",
92 )
93 cache_compressed_dp = HttpReader(cache_compressed_dp).end_caching(mode="wb", same_filepath_fn=True)
NameError: name 'IterableWrapper' is not defined
My environment screen dump is below. Thanks.
Collecting environment information...
PyTorch version: 1.13.0.dev20220525
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A
OS: macOS 12.3.1 (x86_64)
GCC version: Could not collect
Clang version: 13.1.6 (clang-1316.0.21.2.5)
CMake version: Could not collect
Libc version: N/A
Python version: 3.10.4 (main, Mar 31 2022, 03:38:35) [Clang 12.0.0 ] (64-bit runtime)
Python platform: macOS-10.16-x86_64-i386-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
Versions of relevant libraries:
[pip3] numpy==1.22.4
[pip3] torch==1.13.0.dev20220525
[pip3] torchaudio==0.12.0.dev20220525
[pip3] torchdata==0.5.0.dev20220525
[pip3] torchtext==0.13.0.dev20220525
[pip3] torchvision==0.14.0.dev20220525
[conda] numpy 1.22.4 pypi_0 pypi
[conda] torch 1.13.0.dev20220525 pypi_0 pypi
[conda] torchaudio 0.12.0.dev20220525 pypi_0 pypi
[conda] torchdata 0.5.0.dev20220525 pypi_0 pypi
[conda] torchtext 0.13.0.dev20220525 pypi_0 pypi
[conda] torchvision 0.14.0.dev20220525 pypi_0 pypi
torchtext version is 0.13.0.dev20220525
Issue Analytics
- State:
- Created a year ago
- Reactions:4
- Comments:15 (7 by maintainers)
Top Results From Across the Web
When I run the tutorial, there is an error - nlp - PyTorch Forums
211 for item in _check_default_set(split, splits, fn.name): ... NameError: name 'IterableWrapper' is not defined.
Read more >IterableWrapper is not defined when using WikiText2
NameError : name 'IterableWrapper' is not defined. but I have a different error which says,. No module named 'torchdata'.
Read more >it shows NameError: name 'iterable' is not defined (Example)
When i input def random_item(iterable): it shows NameError: name 'iterable' is not defined (Example) | Treehouse Community.
Read more >torchtext - PyPI
This is a utility library that downloads and prepares public datasets. We do not host or distribute these datasets, vouch for their quality...
Read more >name 'iterable' is not defined 在python中判断一个对象是否可 ...
如果一个对象可迭代意味着可以通过for循环去操作处理它,那么在python中怎样判断一个对象是否可直接迭代?如何生成或将一个对象转化为可迭代的对象 ...
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 FreeTop 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
Top GitHub Comments
You shoud install torchdata, then restart and import torchdata. It worked for me.
I am closing this Issue because TorchData currently provides pre-assembled binaries for Mac M1 on PyPI and Conda after 0.4.1
You should be able to install
torchdata == 0.4.1
andtorchtext == 0.13.1
viapip3 install torch torchdata torchtext
conda install pytorch torchdata torchtext -c pytorch
So, this issue should be resolved for Mac M1.