code: def finetune_pet_dataset(model_ft):
      train_transform = transforms.Compose(
          [
              transforms.Resize(256),
              transforms.RandomCrop(224),
              transforms.RandomHorizontalFlip(),
              transforms.ColorJitter(brightness=0.5, hue=0.3),
              transforms.ToTensor(),
              transforms.Normalize(
                  [0.485, 0.456, 0.406], [0.229, 0.224, 0.225]
              ),
          ]
      )
      val_transform = transforms.Compose(
          [
              transforms.Resize(256),
              transforms.CenterCrop(224),
              transforms.ToTensor(),
              transforms.Normalize(
                  [0.485, 0.456, 0.406], [0.229, 0.224, 0.225]
              ),
          ]
      )
  
      # Apply data augmentation to the tarin_dataset
      train_dataset = OxfordIIITPet(
          root="/tmp/data", transform=train_transform, download=True
      )
      val_dataset = OxfordIIITPet(
          root="/tmp/data", transform=val_transform
      )
  
      # obtain training indices that will be used for validation
      indices = torch.randperm(len(train_dataset))
      val_size = len(train_dataset) // 4
      train_dataset = torch.utils.data.Subset(
          train_dataset, indices[:-val_size]
      )
      val_dataset = torch.utils.data.Subset(
          val_dataset, indices[-val_size:]
      )
  
      # prepare data loaders
      train_dataloader = DataLoader(train_dataset, batch_size=32)
      val_dataloader = DataLoader(val_dataset, batch_size=32)
  
      num_ftrs = model_ft.fc.in_features
  
      # Here the size of each output sample is set to 37.
      model_ft.fc = torch.nn.Linear(num_ftrs, 37)
      loss_ft = torch.nn.CrossEntropyLoss()
      optimizer_ft = torch.optim.SGD(
          model_ft.parameters(),
          lr=0.01,
          momentum=0.9,
          weight_decay=5e-4,
      )
  
      # Compile our model with loss function, optimizer.
      model = Trainer.compile(
          model_ft,
          loss_ft,
          optimizer_ft,
          metrics=[MulticlassAccuracy(num_classes=37)],
      )
      trainer = Trainer(max_epochs=1)
      trainer.fit(
          model,
          train_dataloaders=train_dataloader,
          val_dataloaders=val_dataloader,
      )
  
      return model, train_dataset, val_dataset
  
file_path: BigDL/python/nano/tutorial/inference/pytorch/pytorch_quantization_onnx.py
imports: import torch
  from torchvision import transforms
  from torchvision.datasets import OxfordIIITPet
  from torch.utils.data.dataloader import DataLoader
  from torchvision.models import resnet18
  from bigdl.nano.pytorch import Trainer
  from torchmetrics.classification import MulticlassAccuracy
label_desc: Use image node_id 1 for calling a global function with example usage: finetune_pet_dataset(model_ft) and returns: model,  train_dataset,  val_dataset