Re-basin via implicit Sinkhorn differentiation
Implementation of paper Re-basin via implicit Sinkhorn differentiation (Accepted at CVPR 2023).
pip install sinkhorn-rebasin
|
|
Basics |
![Basics](https://camo.githubusercontent.com/f5e0d0538a9c2972b5d413e0ace04cecd8efd828d133133933dfffec282a4e1b/68747470733a2f2f636f6c61622e72657365617263682e676f6f676c652e636f6d2f6173736574732f636f6c61622d62616467652e737667) |
Models alignment |
![Models alignment](https://camo.githubusercontent.com/f5e0d0538a9c2972b5d413e0ace04cecd8efd828d133133933dfffec282a4e1b/68747470733a2f2f636f6c61622e72657365617263682e676f6f676c652e636f6d2f6173736574732f636f6c61622d62616467652e737667) |
Linear mode connectivity |
![Linear mode connectivity](https://camo.githubusercontent.com/f5e0d0538a9c2972b5d413e0ace04cecd8efd828d133133933dfffec282a4e1b/68747470733a2f2f636f6c61622e72657365617263682e676f6f676c652e636f6d2f6173736574732f636f6c61622d62616467652e737667) |
cd examples
python main_alignment_{mlp|cnn|resnet}.py
Example |
Layer from $\theta_A$
|
Layer from $\pi_{\mathcal{P}}(\theta_A)$
|
Layer from $\theta_B$
|
MLP |
![Alignment modelA MLP](https://github.com/fagp/sinkhorn-rebasin/raw/main/resources/alignment_mlp_modelA.png?raw=true) |
![Alignment pi_modelA MLP](https://github.com/fagp/sinkhorn-rebasin/raw/main/resources/alignment_mlp_pimodelA.gif?raw=true) |
![Alignment modelB MLP](https://github.com/fagp/sinkhorn-rebasin/raw/main/resources/alignment_mlp_modelB.png?raw=true) |
VGG |
![Alignment modelA VGG](https://github.com/fagp/sinkhorn-rebasin/raw/main/resources/alignment_cnn_modelA.png?raw=true) |
![Alignment pi_modelA VGG](https://github.com/fagp/sinkhorn-rebasin/raw/main/resources/alignment_cnn_pimodelA.gif?raw=true) |
![Alignment modelB VGG](https://github.com/fagp/sinkhorn-rebasin/raw/main/resources/alignment_cnn_modelB.png?raw=true) |
ResNet18 |
![Alignment modelA ResNet](https://github.com/fagp/sinkhorn-rebasin/raw/main/resources/alignment_resnet_modelA.png?raw=true) |
![Alignment pi_modelA ResNet](https://github.com/fagp/sinkhorn-rebasin/raw/main/resources/alignment_resnet_pimodelA.gif?raw=true) |
![Alignment modelB ResNet](https://github.com/fagp/sinkhorn-rebasin/raw/main/resources/alignment_resnet_modelB.png?raw=true) |
cd examples
python main_lmc_{mlp|cnn|resnet}.py
Dataset |
Model |
Accuracy LMC |
Cross Entropy Loss LMC |
Mnist |
MLP |
![LMC MLP Accuracy](./resources/lmc_mlp_accuracy.gif) |
![LMC MLP Loss](./resources/lmc_mlp_loss.gif) |
Mnist |
VGG |
![LMC VGG Accuracy](./resources/lmc_cnn_accuracy.gif) |
![LMC VGG Loss](./resources/lmc_cnn_loss.gif) |
Imagenette-320 |
ResNet18 |
![LMC ResNet Accuracy](./resources/lmc_resnet_accuracy.gif) |
![LMC ResNet Loss](./resources/lmc_resnet_loss.gif) |