Code Monkey home page Code Monkey logo

iatransfer's Introduction

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') 

Documentation

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.

iatransfer's People

Contributors

danieluss avatar kamilpiechowiak avatar

Stargazers

 avatar  avatar Jiho Lee avatar Michał Kempka avatar  avatar Kacper Korban avatar

Watchers

James Cloos avatar  avatar

iatransfer's Issues

Basic packaging

Use setuptools to make 2 packages - one for torch tool, one for research distribution.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.