fastnlp / fastNLP

fastNLP: A Modularized and Extensible NLP Framework. Currently still in incubation.
https://gitee.com/fastnlp/fastNLP
Apache License 2.0
3.05k stars 451 forks source link

ImportError: cannot import name 'DataSetIter' from 'fastNLP' 似乎无法调用DataSetIter和BatchIter,其他模块都可以正常调用 #452

Open LincanLi98 opened 1 year ago

LincanLi98 commented 1 year ago

Describe the bug 环境为Anaconda+python3.8, fastNLP版本为1.0.1,可以正常调用其他模块,但无法调用DataSetIter和BatchIter模块。描述如下:

File "./stock_energy/aegan.py", line 10, in from fastNLP import DataSet, DataSetIter, RandomSampler, SequentialSampler ImportError: cannot import name 'DataSetIter' from 'fastNLP' (/Users/mac/opt/anaconda3/lib/python3.8/site-packages/fastNLP/init.py)

Python 3.8.3 (default, Jul 2 2020, 11:26:31) [Clang 10.0.0 ] :: Anaconda, Inc. on darwin Type "help", "copyright", "credits" or "license" for more information.

from fastNLP import DataSet from fastNLP import RandomSampler from fastNLP import SequentialSampler from fastNLP import DataSetIter Traceback (most recent call last): File "", line 1, in ImportError: cannot import name 'DataSetIter' from 'fastNLP' (/Users/mac/opt/anaconda3/lib/python3.8/site-packages/fastNLP/init.py) import fastNLP print(fastNLP.version) 1.0.1

x54-729 commented 1 year ago

您好!新版本的 fastNLP 删除了 DataSetIter 和 BatchIter 模块,您可以查看我们最新版本的文档 DataLoader 的用法,或者安装旧版本(0.7.0 0.6.0等)来继续使用这两个模块