Skip to content

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

Closed
@aashish-chaubey

Description

@aashish-chaubey

❓ 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions