6f8f7608d6d603b49bef0249f169ef413d6e7371,src/codebase/main.py,,main,#Any#,146
Before Change
encoder = MultiLayerRNNEncoder(args.word_dim, args.hid_dim,
args.n_layers, nn.LSTMCell)
if args.cuda:
token_embedder = token_embedder.cuda()
encoder = encoder.cuda()
model = MultiTaskModel(encoder, token_embedder, tasks)
log.info("Finished building model")
model.train_model(args.n_epochs, args.optimizer, args.lr)
After Change
// TODO(Alex): hid_dim depends on if pair input or not
log.info("Loading tasks...")
start_time = time.time()
tasks, tok2idx = process_tasks(args.tasks.split(","), args.hid_dim * 4,
args.max_vocab_size, args.max_seq_len,
args.batch_size, args.cuda)
log.info("\tFinished loading tasks in {0}s".format(
time.time() - start_time))
log.info("Building model...")
start_time = time.time()
embeddings = load_embeddings(args.word_embs_file, tok2idx,
args.word_dim)
token_embedder = TokenEmbedder(embeddings, tok2idx)
//token_embedder = nn.Embedding(args.max_vocab_size, args.word_dim,
// padding_idx=0)
encoder = MultiLayerRNNEncoder(args.word_dim, args.hid_dim,
args.n_layers, nn.LSTMCell)
model = MultiTaskModel(encoder, token_embedder, tasks)
if args.cuda:
model = model.cuda()
log.info("\tFinished building model in {0}s".format(
time.time() - start_time))
model.train_model(args.n_epochs, args.optimizer, args.lr)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: jsalt18-sentence-repl/jiant
Commit Name: 6f8f7608d6d603b49bef0249f169ef413d6e7371
Time: 2017-11-07
Author: wang.alex.c@gmail.com
File Name: src/codebase/main.py
Class Name:
Method Name: main
Project Name: OpenNMT/OpenNMT-py
Commit Name: b87368e1e7fd832b505db9cc08015ac7af8f95de
Time: 2016-12-23
Author: jvanamersfoort@twitter.com
File Name: VAE/main.py
Class Name:
Method Name: train