Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Error running test code AttributeError: type object 'TranslationDataset' has no attribute 'name' #233

@Rj7

Description

@Rj7

When I try to load data a translation dataset using TranslationDataset class I get this error. There is no attribute named name in Dataset class or TranslationDataset.

I tried do as specified in one of the test cases. https://github.com/pytorch/text/blob/master/test/translation.py#L75

data_set = datasets.TranslationDataset.splits(root='../data/',train='training.10k', validation='newstest2012', test='newstest2015',exts=('.de', '.en'), fields=(DE, EN))

~/anaconda3/envs/opennmt/lib/python3.6/site-packages/torchtext/datasets/translation.py in splits(cls, exts, fields, root, train, validation, test, **kwargs)
     57                 Dataset.
     58         """
---> 59         path = cls.download(root)
     60 
     61         train_data = None if train is None else cls(

~/anaconda3/envs/opennmt/lib/python3.6/site-packages/torchtext/data/dataset.py in download(cls, root, check)
    109             dataset_path (str): Path to extracted dataset.
    110         """
--> 111         path = os.path.join(root, cls.name)
    112         check = path if check is None else check
    113         if not os.path.isdir(check):

AttributeError: type object 'TranslationDataset' has no attribute 'name'

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