How lionel-w2/fap works
Project type and purpose
• This is a machine-learning research codebase implementing “Few-Shot Adversarial Prompt Learning” on top of a vision-language foundation model (CLIP).
• It provides multiple adversarial prompt methods (FAP, AdvVLP, AdvMaPLe, Advzsclip, ZsRobust) through a configuration-driven, modular training pipeline.
File structure
• Top-level modules:
• attack/ ← adversarial‐example generator (PGD)
• clip/ ← CLIP model loader, tokenizer, backbone
• zsrobust/ ← zero-shot robustness utilities and wrappers around CLIP
• datasets/ ← dataset wrappers matching Dassl API
• configs/ ← YAML files defining datasets + trainer hyperparameters
• trainers/ ← Python implementations of each prompt-learning algorithm
• scripts/ ← Bash scripts invoking train.py with specific configs
• train.py ← central entry point that reads configs, instantiates modules, runs training + evaluation
• requirements.txt, LICENSE, readme.md
• Patterns:
• Config-first: every experiment is defined by a YAML in configs/…
• Modular “plugin” directories: attack, datasets, clip, trainers, zsrobust
• Shell orchestration in scripts/Adv/… for reproducible few-shot, base→new, cross-dataset workflows
README for additional insights
• Confirms this builds on the Dassl & CoOp frameworks
• Illustrates a core pipeline: (1) sample few-shot data → (2) adversarial prompt training → (3) evaluate zero-/few-shot robustness
• Mentions external dependencies: Dassl, CoOp, CoCoOp, MaPLe, Zsrobust