This is a PyTorch implementation of our paper Revisiting Contrastive Learning in Out-of-Distribution Generalization.
cd correlation_shift
# ERM
sh ERM.sh
# IRM
sh IRM.sh
# Ours, require GPU memory > 24G
sh IRM_CID.sh
Download the PACS dataset from: download_pacs.
Update the "--image_path" in /diversity_shift/ERM_CID.sh according to your path.
cd diversity_shift
sh ERM_CID.sh
Our implementation references the codes in the following repositories: