code: def main(_):
      # Connecting ClearML with the current process,
      # from here on everything is logged automatically
      task = Task.init(
          project_name="examples",
          task_name="PyTorch MNIST train with abseil",
      )
  
      use_cuda = FLAGS.cuda and torch.cuda.is_available()
  
      torch.manual_seed(FLAGS.seed)
  
      device = torch.device("cuda" if use_cuda else "cpu")
  
      kwargs = (
          {"num_workers": 4, "pin_memory": True} if use_cuda else {}
      )
      train_loader = torch.utils.data.DataLoader(
          datasets.MNIST(
              os.path.join("..", "data"),
              train=True,
              download=True,
              transform=transforms.Compose(
                  [
                      transforms.ToTensor(),
                      transforms.Normalize((0.1307,), (0.3081,)),
                  ]
              ),
          ),
          batch_size=FLAGS.batch_size,
          shuffle=True,
          **kwargs,
      )
      test_loader = torch.utils.data.DataLoader(
          datasets.MNIST(
              os.path.join("..", "data"),
              train=False,
              transform=transforms.Compose(
                  [
                      transforms.ToTensor(),
                      transforms.Normalize((0.1307,), (0.3081,)),
                  ]
              ),
          ),
          batch_size=FLAGS.test_batch_size,
          shuffle=True,
          **kwargs,
      )
  
      model = Net().to(device)
      optimizer = optim.SGD(
          model.parameters(), lr=FLAGS.lr, momentum=FLAGS.momentum
      )
  
      for epoch in range(1, FLAGS.epochs + 1):
          train(FLAGS, model, device, train_loader, optimizer, epoch)
          test(FLAGS, model, device, test_loader, epoch)
  
      if FLAGS.save_model:
          torch.save(
              model.state_dict(),
              os.path.join(gettempdir(), "mnist_cnn_abseil.pt"),
          )
  
file_path: clearml/examples/frameworks/pytorch/pytorch_abseil.py
imports: from __future__ import print_function
  import os
  from tempfile import gettempdir
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.optim
  from absl import app, flags
  from torchvision import datasets, transforms
  from clearml import Task, Logger
label_desc: Use image node_id 3 for calling a global function with example usage: main(_) without return types