snap-research / weights2weights

Official Implementation of weights2weights
Other
121 stars 3 forks source link

Do you have code on how did you train the linear classifier? #7

Closed iszihan closed 2 months ago

iszihan commented 2 months ago

As question says.

avdravid commented 2 months ago

The linear classifier is solved via least squares at this code snippet: https://github.com/snap-research/weights2weights/blob/76f0bde99ab8e48a25d825f202115300aef8efc3/editing.py#L43C1-L44C1

The pseudoinverse is precomputed and we provide the file at https://huggingface.co/snap-research/weights2weights. It can also be calculated use the proj_1000.pt file by computing torch.inverse(A.T@A)@A.T