286a8cb1abde6e030e935734509d7f6832ce0f7f,OpenNMT/train.py,,main,#,307

Before Change


        print(" * number of training sentences. %d" % len(trainData.src))
        print(" * maximum batch size. %d" % opt.max_batch_size * pool.count)
    else:
        metadata = dict(
            options=opt,
            vocabSize=dict(
                source=dataset.dicts.src.words.size(),
                target=dataset.dicts.tgt.words.size()
            ),
            additionalFeatures=dict(
                source=len(dataset.dicts.src.features),
                target=len(dataset.dicts.tgt.features)
            ),
            sequenceLength=dict(
                source=trainData.maxSourceLength,
                target=trainData.maxTargetLength
            ),
            trainingSentences = len(trainData.src)
        )

        onmt.utils.Log.logJson(metadata)

After Change


    model = {}
    if checkpoint.models:
        encoder = onmt.Models.loadEncoder(checkpoint.models.encoder, idx > 1)
        decoder = onmt.Models.loadDecoder(checkpoint.models.decoder, idx > 1)
    else:
        encoder = onmt.Models.buildEncoder(opt, dataset.dicts.src)
        decoder = onmt.Models.buildDecoder(opt, dataset.dicts.tgt, not opt.json_log)

    model = nn.Sequential(encoder, decoder)

    trainModel(model, trainData, validData, dataset, checkpoint.info)

if __name__ == "__main__":
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: OpenNMT/OpenNMT-py
Commit Name: 286a8cb1abde6e030e935734509d7f6832ce0f7f
Time: 2016-12-23
Author: alerer@fb.com
File Name: OpenNMT/train.py
Class Name:
Method Name: main


Project Name: inferno-pytorch/inferno
Commit Name: d795f811eb13a20e18aa30c435cef0ad99e830ea
Time: 2018-08-10
Author: thorsten.beier@iwr.uni-heidelberg.de
File Name: examples/plot_unet_tutorial.py
Class Name:
Method Name: