3128e13109c8766eafb413f2428bba976701e929,beginner_source/transformer_tutorial.py,,,#,295

Before Change



for epoch in range(1, epochs + 1):
    epoch_start_time = time.time()
    train()
    val_loss = evaluate(model, val_data)
    print("-" * 89)
    print("| end of epoch {:3d} | time: {:5.2f}s | valid loss {:5.2f} | "
          "valid ppl {:8.2f}".format(epoch, (time.time() - epoch_start_time),

After Change


// equal to the length of the vocab object.
//

ntokens = len(vocab.stoi) // the size of vocabulary
emsize = 200 // embedding dimension
nhid = 200 // the dimension of the feedforward network model in nn.TransformerEncoder
nlayers = 2 // the number of nn.TransformerEncoderLayer in nn.TransformerEncoder
nhead = 2 // the number of heads in the multiheadattention models
dropout = 0.2 // the dropout value
model = TransformerModel(ntokens, emsize, nhead, nhid, nlayers, dropout).to(device)


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Run the model
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: pytorch/tutorials
Commit Name: 3128e13109c8766eafb413f2428bba976701e929
Time: 2020-12-02
Author: 6156351+zhangguanheng66@users.noreply.github.com
File Name: beginner_source/transformer_tutorial.py
Class Name:
Method Name:


Project Name: pytorch/tutorials
Commit Name: 133e5b6a84e126cbcfbc5c11eeb6286185dbec2f
Time: 2020-12-02
Author: 6156351+zhangguanheng66@users.noreply.github.com
File Name: beginner_source/torchtext_translation_tutorial.py
Class Name:
Method Name:


Project Name: ray-project/ray
Commit Name: 415be78cc0d1275a29d0ceda550d0d7a7a5224ea
Time: 2020-09-08
Author: amogkam@users.noreply.github.com
File Name: python/ray/util/sgd/torch/training_operator.py
Class Name: TrainingOperator
Method Name: train_epoch