Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

torchtext.data.Field is not working but torchtext.legacy.data.Field is! The documentation doesn't help either #1636

Closed
aashish-chaubey opened this issue Mar 2, 2022 · 1 comment

Comments

@aashish-chaubey
Copy link

❓ Questions and Help

Made a fresh installation of torchtext and followed the documentation to use the Field

from torchtext import data

For some reason, this doesn't work and throws the following error

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

However, this works

from torchtext.legacy import data

The specification of my systems are mentioned below.

torchtext version:  0.11.2
torch version:  1.10.2+cu102
OS:  Linux 5.14.0-1024-oem #26-Ubuntu 
Python verson:  3.8.10 (default, Nov 26 2021, 20:14:08) 
[GCC 9.3.0]

Description
By using the legacy, I am able to create the field. Also, I read that this is usually the case when there is a version mismatch. Any help?

@Nayef211
Copy link
Contributor

Nayef211 commented Mar 7, 2022

Hi @aashish-chaubey. I believe the Field class has been moved to the legacy folder since torchtext 0.9.0 release. Here are the release notes that go into more detail about this https://github.com/pytorch/text/tree/v0.11.2/torchtext/legacy#legacy. The legacy folder is deleted altogether in #1437 and will not be available in torchtext 0.12.0 onwards.

@Nayef211 Nayef211 closed this as completed Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants