Prerequisites
LAFT requires:- Python 3.11 or higher
- CUDA-capable GPU (recommended for performance)
- 8GB+ GPU memory for most experiments
Environment Setup
Create a Conda Environment
We recommend using conda to manage your Python environment:
While conda is recommended, you can also use virtualenv or other environment managers.
Install PyTorch
Install PyTorch from the official website first to ensure proper CUDA support:
Dependencies
Therequirements.txt includes:
Tested Versions
LAFT has been tested with:torch==2.5.1torchvision==0.20.1torcheval==0.0.7open_clip_torch==2.29.0
Dataset Setup
LAFT supports multiple datasets for semantic and industrial anomaly detection.- Semantic Datasets
- Industrial Datasets
Directory Structure
Organize datasets in thedata/ directory:MNIST (ColorMNIST)
The MNIST dataset will be automatically downloaded when first used:Waterbirds
Download from the Waterbirds repository and extract todata/waterbirds_v1.0/.CelebA
Download from the CelebA website and extract todata/celeba/.Checkpoint Downloads
For baseline comparisons, download pre-trained checkpoints:CLIPN Checkpoints
CLIPN Checkpoints
Download from the CLIPN repository:Download each repeat checkpoint:
- repeat1 →
checkpoints/clipn/repeat1.pt - repeat2 →
checkpoints/clipn/repeat2.pt - repeat3 →
checkpoints/clipn/repeat3.pt
CLIPN checkpoints are only needed for running baseline comparisons, not for core LAFT functionality.
InCTRL Checkpoints
InCTRL Checkpoints
Download from the InCTRL repository:Download from Google Drive:MVTec AD:
- Download link
- Extract to:
checkpoints/inctrl/mvtec{2,4,8}.pt
- Download link
- Extract to:
checkpoints/inctrl/visa{2,4,8}.pt
Final Directory Structure
After completing installation, your directory should look like:Verification
Verify your installation:Common Issues
CUDA out of memory
CUDA out of memory
If you encounter OOM errors:Or reduce batch size in your experiments.
OpenCLIP download errors
OpenCLIP download errors
If model downloads fail, manually specify the cache directory:
Dataset not found errors
Dataset not found errors
Ensure datasets are in the correct directory structure and paths match the expected locations:
Next Steps
Quick Start Guide
Run your first LAFT example to verify everything works correctly
