valloader = DataLoader(dataset=valset,
                           batch_size=args.batch_size,
                           shuffle=False,
                           num_workers=args.num_workers,
                           pin_memory=True)

    # model
    model = BaseModel(model_name=args.model_name,
                      num_classes=args.num_classes,
                      pretrained=args.pretrained)

    if args.resume:
        state = torch.load(args.resume)
        print('Resume from:{}'.format(args.resume))
        model.load_state_dict(state['net'], strict=False)
        best_acc = state['acc']
        start_epoch = state['epoch'] + 1
        if 'ols' in args.loss:
            criterion['ols'].matrix = state['ols'].cuda()

    # sync_bn
    if args.sync_bn and multi_gpus:
        model = torch.nn.SyncBatchNorm.convert_sync_batchnorm(model)
        print('Using SyncBatchNorm')

    if multi_gpus:
        device = torch.device("cuda", args.local_rank)
        model = model.to(device)
        model = nn.parallel.DistributedDataParallel(
            model, device_ids=[args.local_rank])