"module 'torchtext.data' has no attribute 'Field'"
import torchtext

ENGLISH = torchtext.data.Field(tokenize=tokenizer_english, lower=True, init_token=&quot;&lt;sos&gt;&quot;, eos_token=&quot;&lt;eos&gt;&quot;)

Error:
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
&lt;ipython-input-12-2a3d11c77e7d&gt; in &lt;module&gt;
----&gt; 1 ENGLISH = torchtext.data.Field(tokenize=tokenizer_english, lower=True, init_token=&quot;&lt;sos&gt;&quot;, eos_token=&quot;&lt;eos&gt;&quot;)

AttributeError: module 'torchtext.data' has no attribute 'Field'

It won't import torchtext.data.Field for some reason even though that's whats in the docs


[BC Breaking] Legacy
In v0.9.0 release, we move the following legacy code to torchtext.legacy. This is part of the work to revamp the torchtext library and the motivation has been discussed in Issue #664:

torchtext.legacy.data.field
torchtext.legacy.data.batch
torchtext.legacy.data.example
torchtext.legacy.data.iterator
torchtext.legacy.data.pipeline
torchtext.legacy.datasets


We have a migration tutorial to help users switch to the torchtext datasets in v0.9.0 release. For the users who still want the legacy components, they can add legacy to the import path.

Try it with ENGLISH = torchtext.legacy.data.field(tokenize=tokenizer_english, lower=True, init_token=&quot;&lt;sos&gt;&quot;, eos_token=&quot;&lt;eos&gt;&quot;)
