Skip to main content

Tool for inter-architecture weight transfer

Project description

Toolkit Research Documentation

Coverage Release Release License Platform Python Pytorch

Inter-Architecture Knowledge Transfer

iatransfer is a PyTorch package for transferring pretrained weights between models of different architectures instantaneously.

Drastically speed up your training process using two additional lines of code.

Installation

pip install iatransfer

Usage

  • simple
import torch
from iatransfer.toolkit import IAT

transfer = IAT()

# run training on Model1()
model_from: nn.Module = Model1()

train(model_from)

# instantiate new model
model_to: nn.Module = Model2() 

# enjoy high-accuracy initialization
transfer(model_from, model_to)
  • parametrization
from iatransfer.toolkit import IAT


iat = IAT(standardization='blocks', matching='dp', score='autoencoder', transfer='trace')

# ==== or

iat = IAT(matching=('dp', {'param': 'value'}))

# ==== or

from iatransfer.toolkit.matching.dp_matching import DPMatching

iat = IAT(matching=DPMatching())
  • plugins
from iatransfer.toolkit.base_matching import Matching


class CustomMatching(Matching):

    def match(self, from_module, to_module, *args, **kwargs)
        # provide your implementation


# This will instantiate the above CustomMatching in IAT
iat = IAT(matching='custom') 

Citation

When referring to or using iatransfer in a scientific publication, please consider including citation to the following thesis:

@manual{
 iat2021,
 title = {Inter-Architecture Knowledge Transfer},
 author = {Maciej A. Czyzewski and Daniel Nowak and Kamil Piechowiak},
 note = {Transfer learning between different architectures},
 organization = {Poznan University of Technology},
 type = {Bachelor’s Thesis},
 address = {Poznan, Poland},
 year = {2021}
}

Development

Init:

./dev/init.sh

Run tests:

nosetests tests

Install in edit mode:

pip install -e .

Research reproduction:

Copy the source code to the GCP cloudshell or install iatransfer_research package.

Run:

/bin/bash ./scripts/research/iatransfer_full_run.sh

or

iatransfer_full_run.sh

if iatransfer_research has been installed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

iatransfer-1.0.3-py3-none-any.whl (42.5 kB view details)

Uploaded Python 3

File details

Details for the file iatransfer-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: iatransfer-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 42.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5

File hashes

Hashes for iatransfer-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cef9609a15f5dca1bbd42ac85818eeef8b23801464ae53dcc94743ed8a090566
MD5 392db81f9cf122a3fcd3fa2f4ebd6090
BLAKE2b-256 5c7753588ee18adfbe592efe75e57bc52fbda990038a65be6a4d79f75c30ea87

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page