How do I modify this line to use my own pruned model instead those defined in the torchvision library ?

  
      github.com
  
  
    amrit-das/Custom-Model-Training-PyTorch/blob/master/predict.py#L23 1



parser = argparse.ArgumentParser(description = 'To Predict from a trained model')
parser.add_argument('-i','--image', dest = 'image_name', required = True, help='Path to the image file')
parser.add_argument('-m','--model', dest = 'model_name', required = True, help='Path to the model')
parser.add_argument('-n','--num_class',dest = 'num_classes', required = True, help='Number of training classes')
args = parser.parse_args()


path_to_model = "./models/"+args.model_name
checkpoint = torch.load(path_to_model)


model = resnet18(num_classes = int(args.num_classes))
model.load_state_dict(checkpoint)
model.eval()


def predict_image(image_path):
print("prediciton in progress")
image = Image.open(image_path)
transformation = transforms.Compose([
    transforms.RandomResizedCrop(224),
    transforms.RandomHorizontalFlip(),
    transforms.ToTensor(),