MCPcopy Index your code
hub / github.com/CHENGY12/PLOT

github.com/CHENGY12/PLOT @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
417 symbols 1,421 edges 67 files 51 documented · 12%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

PLOT: Prompt Learning with Optimal Transport for Vision-Language Models

Created by Guangyi Chen, Weiran Yao, Xiangchen Song, Xinyue Li, Yongming Rao, Kun Zhang

This repository contains PyTorch implementation for ICLR2023 spotlight paper PLOT:Prompt Learning with Optimal Transport for Vision-Language Models [arXiv]

PLOT is a method to jointly learn multiple comprehensive prompts to describe diverse characteristics of categories such as intrinsic attributes or extrinsic contexts. To solve the degradation problem of multiple prompts, we introduce optimal transport to match the multiple local patterns of vision and text modalities. Specifically, we first model images and the categories with visual and textual feature sets. Then, we apply a two-stage optimization strategy to learn the prompts. In the inner loop, we optimize the optimal transport distance to align visual features and prompts by the Sinkhorn algorithm, while in the outer loop, we learn the prompts by this distance from the supervised data.

intro

Updates

  • May 2023: We release a brief script for the visualization.

  • April 2023: PLOT can further benifit from the initilization using ChatGPT and obtain the average 1 shot performance on 11 datasets as 71.7! Code will come soon!

  • March 2023: PLOT can support the VIT-B/16 backbone now and obtain the average 1 shot performance on 11 datasets as 70.6! Please refer to PLOT++ for details.

PLOT for Prompt Learning

See PLOT-CoOp.

PLOT for Adapter-based Methods

See PLOT-Adapter.

PLOT for Multi-modal Prompt Learning

See PLOT-PP.

License

MIT License

Citation

If you find our work useful in your research, please consider citing:

@inproceedings{chen2023plot,
  title={Prompt Learning with Optimal Transport for Vision-Language Models},
  author={Chen, Guangyi and Yao, Weiran and Song, Xiangchen and Li, Xinyue and Rao, Yongming and Zhang, Kun}
  booktitle={ICLR},
  year={2023}
}

Core symbols most depended-on inside this repo

generate_fewshot_dataset
called by 52
plot-adapter/datasets/utils.py
listdir_nohidden
called by 22
plot-adapter/datasets/utils.py
subsample_classes
called by 11
plot-pp/datasets/oxford_pets.py
subsample_classes
called by 11
plot-coop/datasets/oxford_pets.py
save_split
called by 9
plot-pp/datasets/oxford_pets.py
read_split
called by 9
plot-pp/datasets/oxford_pets.py
tip_plot
called by 9
plot-adapter/utils.py
cls_acc
called by 9
plot-adapter/utils.py

Shape

Method 248
Class 88
Function 81

Languages

Python100%

Modules by API surface

plot-pp/clip/model.py36 symbols
plot-coop/clip/model.py36 symbols
plot-adapter/clip/model.py36 symbols
plot-adapter/datasets/utils.py33 symbols
plot-pp/trainers/plotpp.py18 symbols
plot-coop/trainers/plot.py17 symbols
plot-adapter/main_imagenet.py14 symbols
plot-adapter/main.py14 symbols
plot-pp/clip/simple_tokenizer.py10 symbols
plot-coop/clip/simple_tokenizer.py10 symbols
plot-adapter/clip/simple_tokenizer.py10 symbols
plot-pp/datasets/oxford_pets.py9 symbols

For agents

$ claude mcp add PLOT \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact