问题描述
做文本分类的时候发现这个问题:from torchtext.datasets import text_classification
报错:
ImportError: cannot import name 'text_classification' from 'torchtext.datasets'
阅读源码发现没有这个模块,查看官方文档发现新版本较大改动。
解决方法
更改导入方式:
torchtext.datasets.AG_NEWS(root='.data'
做文本分类的时候发现这个问题:from torchtext.datasets import text_classification
报错:
ImportError: cannot import name 'text_classification' from 'torchtext.datasets'
阅读源码发现没有这个模块,查看官方文档发现新版本较大改动。
更改导入方式:
torchtext.datasets.AG_NEWS(root='.data'