Giter Site home page Giter Site logo

athlonk7 / meta-weight-net_code-optimization Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shiyunyi/meta-weight-net_code-optimization

0.0 0.0 0.0 21 KB

A new code framework that uses pytorch to implement meta-learning, and takes Meta-Weight-Net as an example.

License: MIT License

Python 100.00%

meta-weight-net_code-optimization's Introduction

Meta-Weight-Net_Code-Optimization

A new code framework that uses pytorch to implement meta-learning, and takes Meta-Weight-Net as an example.


By using a trick, meta-learning and meta-networks have become plug-and-play. We can now apply the meta learning algorithm directly to the existing pytorch model without rewriting it.

This code takes Meta-Weight-Net (Meta-Weight-Net: Learning an Explicit Mapping For Sample Weighting) as an example to show how to use this trick. It rewrites an optimizer to assign non leaf node tensors to model parameters. See meta.py and line 90-120 of main.py for details.

Environment

  • python 3.8
  • pytorch 1.9.0
  • torchvision 0.10.0

noisy_long_tail_CIFAR.py can generate noisy and long-tailed CIFAR datasets by calling torchvision.datasets. Because some class attributes' names have been changed, errors may occur in some earlier versions of torchvision. It can be solved by changing the corresponding attribute name.

Running this example

ResNet32 on CIFAR10-LT with imbalanced factor of 50:

python main.py --imbalanced_factor 50

ResNet32 on CIFAR10 with 40% uniform noise:

python main.py --meta_lr 1e-3 --meta_weight_decay 1e-4 --corruption_type uniform --corruption_ratio 0.4

Resuilt(CIFAR10)

Data Setting Test Accuracy
imbalanced factor 50 80.43%
imbalanced factor 100 75.92%
imbalanced factor 200 68.89%
40% uniform noise 87.83%

Acknowledgements

Thanks to the original code of Meta-Weight-Net (https://github.com/xjtushujun/meta-weight-net).

Contact: Shi Yunyi ([email protected])

meta-weight-net_code-optimization's People

Contributors

shiyunyi avatar

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.