Issue
I want to split the UDPOS dataset into train, valid, and test by fields. Below is my code-
import torch
import torch.nn as nn
import torch.optim as optim
from torchtext.legacy import data
from torchtext import datasets
SEED = 1234
random.seed(SEED)
np.random.seed(SEED)
torch.manual_seed(SEED)
torch.backends.cudnn.deterministic = True
TEXT = data.Field(lower = True)
UD_TAGS = data.Field(unk_token = None)
PTB_TAGS = data.Field(unk_token = None)
fields = (("text", TEXT), ("udtags", UD_TAGS), ("ptbtags", PTB_TAGS))
train_data, valid_data, test_data = datasets.UDPOS.splits(fields)
This code give me following error-
I am using Pytorch version - '1.10.2'.
How do I split the UDPOS dataset using fileds in the current version.
Solution
I solved the same problem by changing the code
from torchtext import datasets
to
from torchtext.legacy import datasets
Answered By - cottonlove
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.