agnews_train, agnews_test = torchtext.datasets.text_classification.DATASETS["AG_NEWS"](root="./datasets")
after running above line I am geting attribute error.
AttributeError Traceback (most recent call last) in ----> 1 agnews_train, agnews_test = torchtext.datasets.text_classification.DATASETS"AG_NEWS"
AttributeError: module 'torchtext.datasets' has no attribute 'text_classification'
You are probably just using a different version. What you want is:
Documentation