code: def main():
      global args, best_prec1
      args = parser.parse_args()
  
      # create model
      print("=> creating model '{}'".format(args.arch))
      if args.pretrained.lower() not in [
          "false",
          "none",
          "not",
          "no",
          "0",
      ]:
          print(
              "=> using pre-trained parameters '{}'".format(
                  args.pretrained
              )
          )
          model = pretrainedmodels.__dict__[args.arch](
              num_classes=1000, pretrained=args.pretrained
          )
      else:
          model = pretrainedmodels.__dict__[args.arch]()
  
      # optionally resume from a checkpoint
      if args.resume:
          if os.path.isfile(args.resume):
              print("=> loading checkpoint '{}'".format(args.resume))
              checkpoint = torch.load(args.resume)
              args.start_epoch = checkpoint["epoch"]
              best_prec1 = checkpoint["best_prec1"]
              model.load_state_dict(checkpoint["state_dict"])
              print(
                  "=> loaded checkpoint '{}' (epoch {})".format(
                      args.resume, checkpoint["epoch"]
                  )
              )
          else:
              print(
                  "=> no checkpoint found at '{}'".format(args.resume)
              )
  
      cudnn.benchmark = True
  
      # Data loading code
      # traindir = os.path.join(args.data, 'train')
      valdir = os.path.join(args.data, "val")
  
      # train_loader = torch.utils.data.DataLoader(
      #     datasets.ImageFolder(traindir, transforms.Compose([
      #         transforms.RandomSizedCrop(max(model.input_size)),
      #         transforms.RandomHorizontalFlip(),
      #         transforms.ToTensor(),
      #         normalize,
      #     ])),
      #     batch_size=args.batch_size, shuffle=True,
      #     num_workers=args.workers, pin_memory=True)
  
      # if 'scale' in pretrainedmodels.pretrained_settings[args.arch][args.pretrained]:
      #     scale = pretrainedmodels.pretrained_settings[args.arch][args.pretrained]['scale']
      # else:
      #     scale = 0.875
      scale = 0.875
  
      print(
          "Images transformed from size {} to {}".format(
              int(round(max(model.input_size) / scale)),
              model.input_size,
          )
      )
  
      val_tf = pretrainedmodels.utils.TransformImage(
          model,
          scale=scale,
          preserve_aspect_ratio=args.preserve_aspect_ratio,
      )
  
      val_loader = torch.utils.data.DataLoader(
          datasets.ImageFolder(valdir, val_tf),
          batch_size=args.batch_size,
          shuffle=False,
          num_workers=args.workers,
          pin_memory=True,
      )
  
      # define loss function (criterion) and optimizer
      criterion = nn.CrossEntropyLoss().cuda()
  
      optimizer = torch.optim.SGD(
          model.parameters(),
          args.lr,
          momentum=args.momentum,
          weight_decay=args.weight_decay,
      )
  
      model = torch.nn.DataParallel(model).cuda()
  
      if args.evaluate:
          validate(val_loader, model, criterion)
          return
  
      for epoch in range(args.start_epoch, args.epochs):
          adjust_learning_rate(optimizer, epoch)
  
          # train for one epoch
          train(train_loader, model, criterion, optimizer, epoch)
  
          # evaluate on validation set
          prec1 = validate(val_loader, model, criterion)
  
          # remember best prec@1 and save checkpoint
          is_best = prec1 > best_prec1
          best_prec1 = max(prec1, best_prec1)
          save_checkpoint(
              {
                  "epoch": epoch + 1,
                  "arch": args.arch,
                  "state_dict": model.state_dict(),
                  "best_prec1": best_prec1,
              },
              is_best,
          )
  
imports: from __future__ import print_function, division, absolute_import
  import argparse
  import os
  import shutil
  import time
  import torch
  import torch.nn
  import torch.nn.parallel
  import torch.backends.cudnn
  import torch.optim
  import torch.utils.data
  import torchvision.transforms
  import torchvision.datasets
  import sys
  import pretrainedmodels
  import pretrainedmodels.utils
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types