88508c0fb6791ac415f66405c78cd30b315d395a,snli/train.py,,,#,15

Before Change



train, val, test = datasets.SNLI.splits(inputs, answers)

inputs.build_vocab(train, vectors=(args.data_cache, args.word_vectors, args.d_embed))
answers.build_vocab(train)

train_iter, val_iter, test_iter = data.BucketIterator.splits(
            (train, val, test), batch_size=args.batch_size, device=args.gpu)

After Change



train, val, test = datasets.SNLI.splits(inputs, answers)

if os.path.isfile(args.vocab_cache):
    inputs.build_vocab(train, lower=args.lower)
    inputs.vocab.vectors = torch.load(args.vocab_cache)
else:
    inputs.build_vocab(train, vectors=(args.data_cache, args.word_vectors, args.d_embed), lower=args.lower)
    os.makedirs(os.path.dirname(args.vocab_cache), exist_okay=True)
    torch.save(inputs.vocab.vectors, args.vocab_cache)
answers.build_vocab(train)

train_iter, val_iter, test_iter = data.BucketIterator.splits(
            (train, val, test), batch_size=args.batch_size, device=args.gpu)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: OpenNMT/OpenNMT-py
Commit Name: 88508c0fb6791ac415f66405c78cd30b315d395a
Time: 2017-01-24
Author: bryan.mccann.is@gmail.com
File Name: snli/train.py
Class Name:
Method Name:


Project Name: stanfordnlp/stanza
Commit Name: 13cbc20a0640c6176ba701d2a704cbb243d64c23
Time: 2018-10-29
Author: zyh@stanford.edu
File Name: models/common/vocab.py
Class Name: Vocab
Method Name: __init__