Transfer Learning library for Deep Neural Networks.

Overview

Xfer

Transfer and meta-learning in Python


Each folder in this repository corresponds to a method or tool for transfer/meta-learning. xfer-ml is a standalone MXNet library (installable with pip) which largely automates deep transfer learning. The rest of the folders contain research code for a novel method in transfer or meta-learning, implemented in a variety of frameworks (not necessarily in MXNet).

In more detail:

  • xfer-ml: A library that allows quick and easy transfer of knowledge stored in deep neural networks implemented in MXNet. xfer-ml can be used with data of arbitrary numeric format, and can be applied to the common cases of image or text data. It can be used as a pipeline that spans from extracting features to training a repurposer. The repurposer is then an object that carries out predictions in the target task. You can also use individual components of the library as part of your own pipeline. For example, you can leverage the feature extractor to extract features from deep neural networks or ModelHandler, which allows for quick building of neural networks, even if you are not an MXNet expert.
  • leap: MXNet implementation of "leap", the meta-gradient path learner (link) by S. Flennerhag, P. G. Moreno, N. Lawrence, A. Damianou, which appeared at ICLR 2019.
  • nn_similarity_index: PyTorch code for comparing trained neural networks using both feature and gradient information. The method is used in the arXiv paper (link) by S. Tang, W. Maddox, C. Dickens, T. Diethe and A. Damianou.
  • finite_ntk: PyTorch implementation of finite width neural tangent kernels from the paper On Transfer Learning with Linearised Neural Networks (link), by W. Maddox, S. Tang, P. G. Moreno, A. G. Wilson, and A. Damianou, which appeared at the NeurIPS MetaLearning Workshop 2019.
  • synthetic_info_bottleneck PyTorch implementation of the Synthetic Information Bottleneck algorithm for few-shot classification on Mini-ImageNet, which is used in paper Empirical Bayes Transductive Meta-Learning with Synthetic Gradients (link) by S. X. Hu, P. G. Moreno, Y. Xiao, X. Shen, G. Obozinski, N. Lawrence and A. Damianou, which appeared at ICLR 2020.
  • var_info_distil PyTorch implementation of the paper Variational Information Distillation for Knowledge Transfer (link) by S. Ahn, S. X. Hu, A. Damianou, N. Lawrence, Z. Dai, which appeared at CVPR 2019.

Navigate to the corresponding folder for more details.

Contributing

You may contribute to the existing projects by reading the individual contribution guidelines in each corresponding folder.

License

The code under this repository is licensed under the Apache 2.0 License.

Comments
  • Prior p(w)

    Prior p(w)

    Dear authors,

    According to your ICLR paper Empirical Bayes Transductive Meta-Learning with Synthetic Gradients, it appears p(w) is adjustable and is trained to achieve empirical bayes. However, in your code, sib.py line 29, I belive the p(w) is fixed as a zero-mean gaussian. Please correct me if I were wrong, but how is this implementation achieving empirical bayes?

    Thank you in advance!

    opened by ZeWang95 4
  • Layer factory

    Layer factory

    Issue #, if available:

    Description of changes: Replaced Layer Factory with use of mxnet.symbol.load_json()

    • Removed layer factory files and associated test file.
    • Updated notebooks to fit new API

    By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

    opened by jnkm 4
  • How to compare a custom CNN model (and not only resnet)

    How to compare a custom CNN model (and not only resnet)

    Is your feature request related to a problem? Please describe. I would like to compare two simple vanilla CNN models trained on different datasets. How much changes do I need to do in the current code.

    Describe the solution you'd like Comparing two simple vanilla CNN models trained on different datasets (e.g., MNIST and SVHN)

    Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

    Additional context Add any other context or screenshots about the feature request here.

    opened by tushar-semwal 2
  • Replaced gpyopt with emukit

    Replaced gpyopt with emukit

    Issue #, if available:

    Description of changes: We are phasing out gpyopt in favor of emukit. This PR replaces gpyopt with emukit in xfer-hpo notebook.

    This PR replaces https://github.com/amzn/xfer/pull/59 which was done against a wrong branch

    By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

    opened by apaleyes 2
  • Replaced gpyopt with emukit

    Replaced gpyopt with emukit

    Issue #, if available: n/a

    Description of changes: We are phasing out gpyopt in favor of emukit. This PR replaces gpyopt with emukit in xfer-hpo notebook.

    By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

    opened by apaleyes 2
  • Link is not rendered in the README.md

    Link is not rendered in the README.md

    Github apparently has a bug in its markdown rendering when it won't properly show links that are not http or https. Example of where this is discussed: https://github.com/gollum/gollum/issues/759

    The first link in the README.md is ftp so is affected. As a solution, the link could be to the web page that references the actual paper: http://pages.cs.wisc.edu/~shavlik/abstracts/torrey.handbook09.abstract.html

    opened by apaleyes 2
  • Bump nbconvert from 5.3.1 to 6.3.0 in /xfer-ml/docs/demos

    Bump nbconvert from 5.3.1 to 6.3.0 in /xfer-ml/docs/demos

    Bumps nbconvert from 5.3.1 to 6.3.0.

    Release notes

    Sourced from nbconvert's releases.

    5.5.0 Documentation Release

    This tag is used to provide a working documentation build for RTD.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Update and move Travis for subdirectory

    Update and move Travis for subdirectory

    Issue #, if available: #71

    Description of changes: Move travis config file and update to work with xfer-ml in subdirectory.

    By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

    opened by jnkm 1
  • MXNet Nightly Builds Moved to S3

    MXNet Nightly Builds Moved to S3

    Hi,

    MXNet nightly builds have been moved from PyPI to S3 (https://github.com/pypa/pypi-support/issues/243). If this project requires the nightly builds for CI validation, please make sure that your CI pipeline now takes the nightly builds from https://dist.mxnet.io/python. Furthermore, as MXNet 1.7 and 2.0 are currently in progress simultaneously, we are releasing nightly builds for both 1.x and 2.x. Take mxnet-cu102 for example:

    If you need the nightly builds for 1.x:

    pip install --pre "mxnet-cu102<2" -f https://dist.mxnet.io/python
    

    If you need the nightly builds for 2.x:

    pip install --pre "mxnet-cu102>=2" -f https://dist.mxnet.io/python
    

    Feel free to close this issue if the necessary changes have been made, or If the project doesn't rely on MXNet nightly builds. Thanks.

    opened by szha 1
  • Moved leap from contrib to root folder

    Moved leap from contrib to root folder

    Issue #, if available:

    Description of changes: Moved xfer/xfer-ml/contrib/leap into xfer/leap. The reason for that is that the restructure has all files in flat structure under xfer, instead of inside xfer-ml (which makes sense since e.g. leap does not have dependencies in xfer-ml).

    By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

    opened by adamian 1
  • Restructuring xfer top-level folders

    Restructuring xfer top-level folders

    Issue #, if available:

    Description of changes: Summary: Restructuring xfer such that it becomes a more general Python repository for transfer and meta-learning. The previous state of xfer now becomes a sub-folder named xfer-ml which is only one of the tools contained in the now more general project xfer. Currently xfer-ml is the only library, but soon more will be added (hence the need for restructuring).

    Details:

    • Created xfer-ml subfolder
    • Moved all files and folders (apart from NOTICE and CODE_OF_CONDUCT) inside xfer-ml with no further changes
    • Re-wrote top-level README.md and xfer-ml/README.md to reflect the new nature of the structure.

    In essence, only the new README's have content changes, the rest of the changes is just files moved to the new xfer-ml folder.

    By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

    enhancement 
    opened by adamian 1
  • finite_ntk malaria data generation bug + questions

    finite_ntk malaria data generation bug + questions

    Bug

    I think test_year is supposed to be train_year in line 55 right?

    https://github.com/amzn/xfer/blob/dd4a6a27ca00406df83eec5916d3a76a1a798248/finite_ntk/data.py#L40-L55

    Questions

    I see the variables inside, extent and grid_x being declared but not used in the malaria experiments. I'm looking to replicate the experiments in JAX so I was wondering what the original purpose of these variables were. In particular, what is the sparse tensor for marking Nigeria and inside supposed to be doing?

    https://github.com/amzn/xfer/blob/dd4a6a27ca00406df83eec5916d3a76a1a798248/finite_ntk/data.py#L80-L100

    P.S. thank you for the work and for releasing the code!

    opened by tingtang2 1
  • Add unsupervised learning experiments for linear_ntk

    Add unsupervised learning experiments for linear_ntk

    Adds the code to reproduce Figure 7b (olivetti dataset) and Table 1 (unsupervised to supervised experiments) of https://arxiv.org/pdf/2103.01439.pdf that had not been included in the public version previously.

    Let me know if I still need to modify licenses / attribution here.

    @shuaitang @pgmoren

    By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

    opened by wjmaddox 0
  • current_pars not used

    current_pars not used

    Maybe I am missing something. I don't see where current_pars argument is used inside the losses. Is it used, if not I guess why it is passed?

    https://github.com/amzn/xfer/blob/dd4a6a27ca00406df83eec5916d3a76a1a798248/finite_ntk/experiments/cifar/losses.py#L22

    opened by evcu 1
  • when --config config/miniImageNet_1shot.json , AttributeError: 'list' object has no attribute 'items' for EasyDict

    when --config config/miniImageNet_1shot.json , AttributeError: 'list' object has no attribute 'items' for EasyDict

    Hello, a great work! Thank you for sharing the codes. I to begin the Step 2 in README : python main.py --config config/miniImageNet_1shot.yaml --seed 100 --gpu 0

    Firstly, I congfig the miniImageNet_1shot.json file path in config.py like this:

    def get_args(): """ Create argparser for frequent configurations.

    :return: argparser object
    """
    argparser = argparse.ArgumentParser(description=__doc__)
    argparser.add_argument(
        '-c', '--config',
        metavar='C',
        default="/home/dy/PP/FSL/sib_meta_learn/data/Mini-ImageNet/val1000Episode_5_way_5_shot.json",
        help='The Configuration file')
    

    Then, I run main,py, there's an error like this: image

    Would you please help me solve the problem? Appreciate!

    opened by DanielaPlusPlus 1
  • Fix scikit errors

    Fix scikit errors

    Issue #, if available:

    Description of changes:

    By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

    opened by jnkm 0
Owner
Amazon
Amazon
PyKale is a PyTorch library for multimodal learning and transfer learning as well as deep learning and dimensionality reduction on graphs, images, texts, and videos

PyKale is a PyTorch library for multimodal learning and transfer learning as well as deep learning and dimensionality reduction on graphs, images, texts, and videos. By adopting a unified pipeline-based API design, PyKale enforces standardization and minimalism, via reusing existing resources, reducing repetitions and redundancy, and recycling learning models across areas.

PyKale 370 Dec 27, 2022
Bayesian-Torch is a library of neural network layers and utilities extending the core of PyTorch to enable the user to perform stochastic variational inference in Bayesian deep neural networks

Bayesian-Torch is a library of neural network layers and utilities extending the core of PyTorch to enable the user to perform stochastic variational inference in Bayesian deep neural networks. Bayesian-Torch is designed to be flexible and seamless in extending a deterministic deep neural network architecture to corresponding Bayesian form by simply replacing the deterministic layers with Bayesian layers.

Intel Labs 210 Jan 4, 2023
code for our paper "Source Data-absent Unsupervised Domain Adaptation through Hypothesis Transfer and Labeling Transfer"

SHOT++ Code for our TPAMI submission "Source Data-absent Unsupervised Domain Adaptation through Hypothesis Transfer and Labeling Transfer" that is ext

null 75 Dec 16, 2022
Transfer style api - An API to use with Tranfer Style App, where you can use two image and transfer the style

Transfer Style API It's an API to use with Tranfer Style App, where you can use

Brian Alejandro 1 Feb 13, 2022
Complex-Valued Neural Networks (CVNN)Complex-Valued Neural Networks (CVNN)

Complex-Valued Neural Networks (CVNN) Done by @NEGU93 - J. Agustin Barrachina Using this library, the only difference with a Tensorflow code is that y

youceF 1 Nov 12, 2021
A framework that constructs deep neural networks, autoencoders, logistic regressors, and linear networks

A framework that constructs deep neural networks, autoencoders, logistic regressors, and linear networks without the use of any outside machine learning libraries - all from scratch.

Kordel K. France 2 Nov 14, 2022
An implementation demo of the ICLR 2021 paper Neural Attention Distillation: Erasing Backdoor Triggers from Deep Neural Networks in PyTorch.

Neural Attention Distillation This is an implementation demo of the ICLR 2021 paper Neural Attention Distillation: Erasing Backdoor Triggers from Deep

Yige-Li 84 Jan 4, 2023
DeepHyper: Scalable Asynchronous Neural Architecture and Hyperparameter Search for Deep Neural Networks

What is DeepHyper? DeepHyper is a software package that uses learning, optimization, and parallel computing to automate the design and development of

DeepHyper Team 214 Jan 8, 2023
Selene is a Python library and command line interface for training deep neural networks from biological sequence data such as genomes.

Selene is a Python library and command line interface for training deep neural networks from biological sequence data such as genomes.

Troyanskaya Laboratory 323 Jan 1, 2023
This repository contains notebook implementations of the following Neural Process variants: Conditional Neural Processes (CNPs), Neural Processes (NPs), Attentive Neural Processes (ANPs).

The Neural Process Family This repository contains notebook implementations of the following Neural Process variants: Conditional Neural Processes (CN

DeepMind 892 Dec 28, 2022
Deep learning (neural network) based remote photoplethysmography: how to extract pulse signal from video using deep learning tools

Deep-rPPG: Camera-based pulse estimation using deep learning tools Deep learning (neural network) based remote photoplethysmography: how to extract pu

Terbe Dániel 138 Dec 17, 2022
Style transfer, deep learning, feature transform

FastPhotoStyle License Copyright (C) 2018 NVIDIA Corporation. All rights reserved. Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons

NVIDIA Corporation 10.9k Jan 2, 2023
Code for "Neural Parts: Learning Expressive 3D Shape Abstractions with Invertible Neural Networks", CVPR 2021

Neural Parts: Learning Expressive 3D Shape Abstractions with Invertible Neural Networks This repository contains the code that accompanies our CVPR 20

Despoina Paschalidou 161 Dec 20, 2022
A flexible framework of neural networks for deep learning

Chainer: A deep learning framework Website | Docs | Install Guide | Tutorials (ja) | Examples (Official, External) | Concepts | ChainerX Forum (en, ja

Chainer 5.8k Jan 6, 2023
Code samples for my book "Neural Networks and Deep Learning"

Code samples for "Neural Networks and Deep Learning" This repository contains code samples for my book on "Neural Networks and Deep Learning". The cod

Michael Nielsen 13.9k Dec 26, 2022
State of the Art Neural Networks for Deep Learning

pyradox This python library helps you with implementing various state of the art neural networks in a totally customizable fashion using Tensorflow 2

Ritvik Rastogi 60 May 29, 2022
A flexible framework of neural networks for deep learning

Chainer: A deep learning framework Website | Docs | Install Guide | Tutorials (ja) | Examples (Official, External) | Concepts | ChainerX Forum (en, ja

Chainer 5.5k Feb 12, 2021
Deep learning for spiking neural networks

A deep learning library for spiking neural networks. Norse aims to exploit the advantages of bio-inspired neural components, which are sparse and even

Electronic Vision(s) Group — BrainScaleS Neuromorphic Hardware 59 Nov 28, 2022