def METHOD_NAME():
    ms.set_seed(1)
    ms.set_context(mode=ms.PYNATIVE_MODE)
    # --------------------------- Prepare data -------------------------#
    # create dataset for train and val
    init()
    device_num = get_group_size()
    rank_id = get_rank()
    ms.set_auto_parallel_context(
        device_num=device_num,
        parallel_mode="data_parallel",
        gradients_mean=True,
    )
    num_classes = 10
    num_workers = 8
    data_dir = "/data/cifar-10-batches-bin"
    download = False if os.path.exists(data_dir) else True
    dataset_train = create_dataset(
        name="cifar10",
        root=data_dir,
        split="train",
        shuffle=True,
        download=download,
        num_shards=device_num,
        shard_id=rank_id,
        num_parallel_workers=num_workers,
    )
    dataset_test = create_dataset(
        name="cifar10",
        root=data_dir,
        split="test",
        shuffle=False,
        download=False,
        num_shards=device_num,
        shard_id=rank_id,
        num_parallel_workers=num_workers,
    )
    # create transform and get trans list
    trans_train = create_transforms(dataset_name="cifar10", is_training=True)
    trans_test = create_transforms(dataset_name="cifar10", is_training=False)
    # get data loader
    loader_train = create_loader(
        dataset=dataset_train,
        batch_size=64,
        is_training=True,
        num_classes=num_classes,
        transform=trans_train,
        num_parallel_workers=num_workers,
        drop_remainder=True,
    )
    loader_test = create_loader(
        dataset=dataset_test,
        batch_size=32,
        is_training=False,
        num_classes=num_classes,
        transform=trans_test,
    )
    num_batches = loader_train.get_dataset_size()
    print("Num batches: ", num_batches)
    # --------------------------- Build model -------------------------#
    network = create_model(model_name="resnet18", num_classes=num_classes, pretrained=False)
    loss = create_loss(name="CE")
    opt = create_optimizer(network.trainable_params(), opt="adam", lr=1e-3)
    # --------------------------- Training and monitoring -------------------------#
    epochs = 10
    for t in range(epochs):
        print(f"Epoch {t + 1}\n-------------------------------")
        save_path = f"./resnet18-{t + 1}_{num_batches}.ckpt"
        b = time()
        train_epoch(network, loader_train, loss, opt)
        print("Epoch time cost: ", time() - b)
        test_epoch(network, loader_test)
        if rank_id in [None, 0]:
            ms.save_checkpoint(network, save_path, async_save=True)
    print("Done!")