code: def main():
      parser = get_parser()
      args = parser.parse_args()
  
      train_loader, test_loader = build_dataset()
      device = "cuda" if torch.cuda.is_available() else "cpu"
  
      ckpt_name = get_ckpt_name(
          model=args.model,
          optimizer=args.optim,
          lr=args.lr,
          final_lr=args.final_lr,
          momentum=args.momentum,
          beta1=args.beta1,
          beta2=args.beta2,
          gamma=args.gamma,
      )
      if args.resume:
          ckpt = load_checkpoint(ckpt_name)
          best_acc = ckpt["acc"]
          start_epoch = ckpt["epoch"]
      else:
          ckpt = None
          best_acc = 0
          start_epoch = -1
  
      net = build_model(args, device, ckpt=ckpt)
      criterion = nn.CrossEntropyLoss()
      optimizer = create_optimizer(args, net.parameters())
      scheduler = optim.lr_scheduler.StepLR(
          optimizer, step_size=150, gamma=0.1, last_epoch=start_epoch
      )
  
      train_accuracies = []
      test_accuracies = []
  
      for epoch in range(start_epoch + 1, 200):
          scheduler.step()
          train_acc = train(
              net, epoch, device, train_loader, optimizer, criterion
          )
          test_acc = test(net, device, test_loader, criterion)
  
          # Save checkpoint.
          if test_acc > best_acc:
              print("Saving..")
              state = {
                  "net": net.state_dict(),
                  "acc": test_acc,
                  "epoch": epoch,
              }
              if not os.path.isdir("checkpoint"):
                  os.mkdir("checkpoint")
              torch.save(state, os.path.join("checkpoint", ckpt_name))
              best_acc = test_acc
  
          train_accuracies.append(train_acc)
          test_accuracies.append(test_acc)
          if not os.path.isdir("curve"):
              os.mkdir("curve")
          torch.save(
              {
                  "train_acc": train_accuracies,
                  "test_acc": test_accuracies,
              },
              os.path.join("curve", ckpt_name),
          )
  
file_path: AdaBound/demos/cifar10/main.py
imports: from __future__ import print_function
  import torch.optim
  import torch.backends.cudnn
  import torchvision
  import torchvision.transforms
  import os
  import argparse
  from models import *
  from adabound import AdaBound
label_desc: Use image node_id 9 for calling a global function with example usage: main() without return types