def main(args, _=None):
    """Run ``catalyst-contrib project-embeddings`` script."""
    df = pd.read_csv(args.in_csv)
    os.makedirs(args.out_dir, exist_ok=True)

    if args.meta_cols is not None:
        meta_header = args.meta_cols.split(",")
    else:
        meta_header = None
        # raise ValueError("meta-cols must not be None")

    features = np.load(args.in_npy, mmap_mode="r")
    assert len(df) == len(features)

    if args.num_rows is not None:
        indices = np.random.choice(len(df), args.num_rows)
        features = features[indices, :]
        df = df.iloc[indices]

    if args.img_col is not None:
        img_data = _load_image_data(
            rootpath=args.img_rootpath,
            paths=df[args.img_col].values,
            img_size=args.img_size,
        )
    else:
        img_data = None

    if meta_header is not None:
        metadata = df[meta_header].values.tolist()
        metadata = [
            [
                str(text)
                .replace("\n", " ")
                .replace(r"\s", " ")
                .replace(r"\s\s+", " ")
                .strip()
                for text in texts
            ]
            for texts in metadata
        ]
        assert len(metadata) == len(features)
    elif args.img_col is not None:

        def _image_name(s):
            splitted = s.rsplit("/", 1)
            return splitted[1] if len(splitted) else splitted[0]

        metadata = [_image_name(str(path)) for path in df[args.img_col].values]
    else:
        metadata = None

    summary_writer = SummaryWriter(args.out_dir)
    summary_writer.add_embedding(
        features,
        label_img=img_data,
        metadata=metadata,
        # metadata_header=(
        #     meta_header
        #     if meta_header is not None and len(meta_header)
        #     else None
        # ),
    )
    summary_writer.close()

    print(f"Done. Run `tensorboard --logdir={args.out_dir}` " + "to view in Tensorboard")
Run ``catalyst-contrib project-embeddings`` script.
catalyst/contrib/scripts/project_embeddings.py