code: def main():
      """
      Runs a full training experiment with evaluations of the model on the val set at every epoch. Furthermore,
      will return the test set evaluation results on the best performing validation model.
      """
      config = Config()
  
      torch.manual_seed(config.seed)
      random.seed(config.seed)
      np.random.seed(config.seed)
  
      device = torch.device(
          "cuda" if torch.cuda.is_available() else "cpu"
      )
  
      # load data
      data = MetaLearningDataLoader(
          config.num_training_tasks,
          config.training_batch_size,
          config.num_training_support,
          config.num_training_query,
          config.num_test_tasks,
          config.test_batch_size,
          config.num_test_support,
          config.num_test_query,
          config.amplitude,
          config.frequency,
          config.phase,
          config.x_range,
      )
  
      model = MAMLModel(config.network_dims, device)
      algo = MAML(
          model,
          device,
          config.num_updates_per_iter,
          config.num_layers,
          config.task_learning_rate,
          config.learnable_learning_rates,
          config.meta_learning_rate,
          config.total_epochs,
          config.min_learning_rate,
          config.learning_rate_scheduler,
          config.second_order,
          config.use_multi_step_loss_optimization,
          config.multi_step_loss_num_epochs,
      )
      agent = MAMLAgent(algo, data, config.total_iter_per_epoch)
  
      for i in range(config.total_epochs):
          logger.info("start epoch {}".format(i + 1))
          agent.train_one_epoch(i)
          loss, h = agent.evaluate()
          summary.add_scalar("test/loss", loss, i)
          logger.info(
              "epoch {}: test loss: {:.3f}+-{:.3f}".format(
                  i + 1, loss, h
              )
          )
  
file_path: PARL/benchmark/torch/maml++/train.py
imports: import random
  import torch
  from parl.utils import logger, summary
  import numpy
  from data import MetaLearningDataLoader
  from maml_model import MAMLModel
  from maml_algorithm import MAML
  from maml_agent import MAMLAgent
  from config import Config
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types