code: def main(
      epochs=120,
      learning_rate=0.1,
      momentum=0.9,
      weight_decay=0,
      batch_size=1024,
      gamma=0.97,
      checkpoint=None,
  ):
      # We create the checkpointing folder if it does not exist.
      if checkpoint and not os.path.isdir(checkpoint):
          os.makedirs(checkpoint)
  
      device = "cuda" if torch.cuda.is_available() else "cpu"
  
      model = models.vgg11()
      model = model.to(device)
  
      # We define the training criterion, optimizer and learning rate scheduler
      criterion = nn.CrossEntropyLoss()
      optimizer = optim.SGD(
          model.parameters(),
          lr=learning_rate,
          momentum=momentum,
          weight_decay=weight_decay,
      )
      lr_scheduler = torch.optim.lr_scheduler.ExponentialLR(
          optimizer, gamma
      )
  
      # We restore the states of model, optimizer and learning rate scheduler if a checkpoint file is
      # available. This will return the last epoch number of the checkpoint or 1 if no checkpoint.
      start_epoch = resume_from_checkpoint(
          checkpoint, model, optimizer, lr_scheduler
      )
  
      # We build the data loaders. test_loader is here for completeness but won't be used.
      train_loader, valid_loader, test_loader = build_data_loaders(
          batch_size=batch_size
      )
  
      # If no training needed, because the trial was resumed from an epoch equal or greater to number
      # of epochs requested here (``epochs``).
      if start_epoch >= epochs + 1:
          return valid(valid_loader, device, model)
  
      # Training from last epoch until ``epochs + 1``, checkpointing at end of each epoch.
      for epoch in range(start_epoch, epochs + 1):
          print("epoch", epoch)
          train(
              train_loader,
              device,
              model,
              optimizer,
              lr_scheduler,
              criterion,
          )
          valid_error_rate = valid(valid_loader, device, model)
          save_checkpoint(
              checkpoint, model, optimizer, lr_scheduler, epoch
          )
  
      return valid_error_rate
  
file_path: orion/examples/tutorials/code_2_hyperband_checkpoint.py
imports: import os
  import numpy
  import torch
  import torch.nn
  import torch.optim
  import torchvision
  import torchvision.models
  import torchvision.transforms
  from torch.utils.data import SubsetRandomSampler
  from orion.client import build_experiment
label_desc: Use image node_id 6 for calling a global function with example usage: main(epochs, learning_rate, momentum, weight_decay, batch_size, gamma, checkpoint) and returns: valid_error_rate, valid