code: def main(args):
      train = read_corpus(args.train)
      dev = read_corpus(args.dev)
      test = read_corpus(args.test)
  
      model = Model(train, args)
      model.cuda()
      sys.stdout.write(
          "vocab size: {}\n".format(model.embedding_layer.n_V)
      )
      sys.stdout.write(
          "num of parameters: {}\n".format(
              sum(
                  x.numel()
                  for x in model.parameters()
                  if x.requires_grad
              )
          )
      )
      model.print_pnorm()
      sys.stdout.write("\n")
  
      map_to_ids = model.embedding_layer.map_to_ids
      train = create_batches(train, map_to_ids, args.batch_size)
      dev = create_batches(dev, map_to_ids, 1)
      test = create_batches(test, map_to_ids, 1)
  
      unchanged = 0
      best_dev = 1e8
      for epoch in range(args.max_epoch):
          start_time = time.time()
          if args.lr_decay_epoch > 0 and epoch >= args.lr_decay_epoch:
              args.lr *= args.lr_decay
          train_ppl = train_model(epoch, model, train)
          dev_ppl = eval_model(model, dev)
          sys.stdout.write(
              "\rEpoch={}  lr={:.4f}  train_ppl={:.2f}  dev_ppl={:.2f}"
              "\t[{:.2f}m]\n".format(
                  epoch,
                  args.lr,
                  train_ppl,
                  dev_ppl,
                  (time.time() - start_time) / 60.0,
              )
          )
          model.print_pnorm()
          sys.stdout.flush()
  
          if dev_ppl < best_dev:
              unchanged = 0
              best_dev = dev_ppl
              start_time = time.time()
              test_ppl = eval_model(model, test)
              sys.stdout.write(
                  "\t[eval]  test_ppl={:.2f}\t[{:.2f}m]\n".format(
                      test_ppl, (time.time() - start_time) / 60.0
                  )
              )
              sys.stdout.flush()
          else:
              unchanged += 1
          if unchanged >= 30:
              break
          sys.stdout.write("\n")
  
imports: import sys
  import os
  import argparse
  import time
  import random
  import math
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from torch.autograd import Variable
  import sru
label_desc: Use image node_id 5 for calling a global function with example usage: main(args) without return types