def METHOD_NAME(args):
    model, dataset = args.model, args.dataset
    model_name = ClipModel.get_model_name_by_index(model)
    dataset_name = ImageTextData.get_data_name_by_index(dataset)
    args.log_file = os.getcwd() + '/log/{}_{}_{}.txt'.format(args.mode, model_name, dataset_name)
    logger = get_logger(args.log_file, args.log_file)
    logger.info(args)
    clip = ClipModel(model,logger=logger)
    logger.info(f'Clip model {model_name} loaded')
    itdata = ImageTextData(dataset, root=args.root, preprocess=clip.preprocess)
    train_loader = torch.utils.data.DataLoader(itdata, batch_size=args.batchsize, shuffle=True)
    logger.info(f'Dataset {dataset_name} loaded')
    if args.mode == 'zs':  # zeroshot
        acc, res = clip.evaluate(train_loader)
        logger.info('Results: {}'.format(res))
        logger.info('Accuracy: {:.2f}%'.format(acc * 100))
    elif args.mode == 'fe': # feature extraction
        res = clip.feature_extraction(train_loader)
        logger.info('Feature extracted!')
        if not os.path.exists('feat'):
            os.makedirs('feat')
        feat_file = 'feat/{}_{}_{}.csv'.format(args.mode, model_name, dataset_name)
        np.savetxt(feat_file, res, fmt='%.4f')
    elif args.mode == 'ft': # fine-tuning
        test_data = ImageTextData(args.test_data, root=args.root, preprocess=clip.preprocess)
        test_loader = torch.utils.data.DataLoader(test_data, batch_size=args.test_batchsize, shuffle=False, drop_last=False)
        optimizer = optim.Adam(clip.model.parameters(), lr=args.lr, betas=(args.beta1, args.beta2), eps=args.eps, weight_decay=args.weight_decay)
        best_acc = clip.finetune(train_loader, test_loader, optimizer, args.nepoch, save_path='/home/jindwang/mine/clipood/model/{}_{}_{}.pt'.format(args.mode, model_name, dataset_name))
        logger.info('Accuracy: {:.2f}%'.format(best_acc * 100))
    else:
        raise NotImplementedError