An implementation of methods described in Git Re-basin-paper by Ainsworth et al.
Project description
rebasin
An implementation of methods described in "Git Re-basin"-paper by Ainsworth et al.
Installation
pip install rebasin
Usage
Currently, only weight-matching is implemented as a method for rebasing, and only a simplified form of linear interpolation is implemented.
from rebasin import PermutationCoordinateDescent
from rebasin import interpolation
model_a, model_b, train_dl, val_dl, loss_fn = ...
input_data = next(iter(train_dl))[0]
# Rebasin
pcd = PermutationCoordinateDescent(model_a, model_b, input_data)
pcd.calculate_permutations()
pcd.apply_permutations()
# Interpolate
lerp = interpolation.LerpSimple(
models=[model_a, model_b],
loss_fn=loss_fn,
train_dataloader=train_dl,
val_dataloader=val_dl
)
lerp.interpolate(steps=10)
# Access model with lowest validation loss:
lerp.best_model
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rebasin-0.0.15.tar.gz.
File metadata
- Download URL: rebasin-0.0.15.tar.gz
- Upload date:
- Size: 17.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a89b9e8a383b7526042468a467f8076aa7c668a24fda0a531687304eb023685c
|
|
| MD5 |
af846dbc54141923dd83a0b6b0776d3f
|
|
| BLAKE2b-256 |
3dbe74a797678356a07af4a1e9183f6352ffd0190be59590332a6e30a56721c8
|
File details
Details for the file rebasin-0.0.15-py3-none-any.whl.
File metadata
- Download URL: rebasin-0.0.15-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
400db37aab40da8c32399a3c1f3b7df162ed829fdc3e7ba12364e37aba978546
|
|
| MD5 |
e8ceb8271f121a4de549ee6ffbfb4e85
|
|
| BLAKE2b-256 |
fa339a9f5e40305135237281d4da58a91621fa8e02367038fc9329221a608da6
|