def METHOD_NAME(args, logger):
    # Features loading/extraction for K-means
    if args.in_features_path:
        # Feature loading
        logger.info(f"Loading features from {args.in_features_path}...")
        features_batch = np.load(args.in_features_path, allow_pickle=True)
    else:
        # Feature extraction
        logger.info(f"Extracting {args.feature_type} acoustic features...")
        features_batch = (
            get_features(
                feature_type=args.feature_type,
                checkpoint_path=args.checkpoint_path,
                layer=args.layer,
                manifest_path=args.manifest_path,
                sample_pct=args.sample_pct,
                flatten=True,
            )
            if not args.out_features_path
            else get_and_dump_features(
                feature_type=args.feature_type,
                checkpoint_path=args.checkpoint_path,
                layer=args.layer,
                manifest_path=args.manifest_path,
                sample_pct=args.sample_pct,
                flatten=True,
                out_features_path=args.out_features_path,
            )
        )
        if args.out_features_path:
            logger.info(
                f"Saved extracted features at {args.out_features_path}"
            )
    logger.info(f"Features shape = {features_batch.shape}\n")
    # Learn and save K-means model
    kmeans_model = get_kmeans_model(
        n_clusters=args.num_clusters,
        init=args.init,
        max_iter=args.max_iter,
        batch_size=args.batch_size,
        tol=args.tol,
        max_no_improvement=args.max_no_improvement,
        n_init=args.n_init,
        reassignment_ratio=args.reassignment_ratio,
        random_state=args.seed,
    )
    logger.info("Starting k-means training...")
    kmeans_model, time_taken = train_kmeans(
        kmeans_model=kmeans_model, features_batch=features_batch
    )
    logger.info(f"...done k-means training in {time_taken} minutes")
    inertia = -kmeans_model.score(features_batch) / len(features_batch)
    logger.info(f"Total intertia: {round(inertia, 2)}\n")
    logger.info(f"Saving k-means model to {args.out_kmeans_model_path}")
    os.makedirs(os.path.dirname(args.out_kmeans_model_path), exist_ok=True)
    joblib.dump(kmeans_model, open(args.out_kmeans_model_path, "wb"))