All Projects → alshedivat → Meta Blocks

alshedivat / Meta Blocks

Licence: bsd-3-clause
A modular toolbox for meta-learning research with a focus on speed and reproducibility.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Meta Blocks

Api Benchmark
A node.js tool to benchmark APIs
Stars: ✭ 293 (+166.36%)
Mutual labels:  api, benchmark
Meta-SelfLearning
Meta Self-learning for Multi-Source Domain Adaptation: A Benchmark
Stars: ✭ 157 (+42.73%)
Mutual labels:  benchmark, meta-learning
Densematchingbenchmark
Dense Matching Benchmark
Stars: ✭ 120 (+9.09%)
Mutual labels:  toolbox, benchmark
Meta Dataset
A dataset of datasets for learning to learn from few examples
Stars: ✭ 483 (+339.09%)
Mutual labels:  meta-learning, benchmark
Src Cli
Sourcegraph CLI
Stars: ✭ 108 (-1.82%)
Mutual labels:  api
Benchexec
BenchExec: A Framework for Reliable Benchmarking and Resource Measurement
Stars: ✭ 108 (-1.82%)
Mutual labels:  benchmark
N26
API and CLI to get information of your N26 account
Stars: ✭ 107 (-2.73%)
Mutual labels:  api
Ddos Rootsec
DDOS Archive by RootSec (Scanners, BotNets (Mirai and QBot Premium & Normal and more), Exploits, Methods, Sniffers)
Stars: ✭ 108 (-1.82%)
Mutual labels:  api
Wally
Distributed Stream Processing
Stars: ✭ 1,461 (+1228.18%)
Mutual labels:  api
Auquan Toolbox Python
Backtesting toolbox for trading strategies - DEPRECATED
Stars: ✭ 108 (-1.82%)
Mutual labels:  toolbox
What I Have Read
Paper Lists, Notes and Slides, Focus on NLP. For summarization, please refer to https://github.com/xcfcode/Summarization-Papers
Stars: ✭ 110 (+0%)
Mutual labels:  meta-learning
Mangopay2 Php Sdk
PHP SDK for MANGOPAY
Stars: ✭ 108 (-1.82%)
Mutual labels:  api
Flask Graphene Sqlalchemy
⚗️Project template to build a GraphQL API in Python
Stars: ✭ 109 (-0.91%)
Mutual labels:  api
Factory bot instruments
Instruments for benchmarking, tracing, and debugging Factory Girl models.
Stars: ✭ 108 (-1.82%)
Mutual labels:  benchmark
Auth0 Aspnetcore Webapi Samples
Auth0 Integration Samples for ASP.NET Core WebAPI Services
Stars: ✭ 109 (-0.91%)
Mutual labels:  api
Ln Paywall
Go middleware for monetizing your API on a per-request basis with Bitcoin and Lightning ⚡️
Stars: ✭ 108 (-1.82%)
Mutual labels:  api
Xseries
Library for cross-version Minecraft Bukkit support and various efficient API methods.
Stars: ✭ 109 (-0.91%)
Mutual labels:  api
Httpcat
httpcat is a simple utility for constructing raw HTTP requests on the command line.
Stars: ✭ 109 (-0.91%)
Mutual labels:  api
Rageframe2
一个基于Yii2高级框架的快速开发应用引擎
Stars: ✭ 1,553 (+1311.82%)
Mutual labels:  api
Go Web Framework Benchmark
⚡ Go web framework benchmark
Stars: ✭ 1,601 (+1355.45%)
Mutual labels:  benchmark

logo

A Modular Toolbox for Accelerating Meta-Learning Research 🚀


PyPI - Python Version PyPI Status Badge Build Status Documentation Status Coverage Status Language grade: Python Code style: black

MetaBlocks is a modular toolbox for research, experimentation, and reproducible benchmarking of learning-to-learn algorithms. The toolbox provides a flexible API for working with MetaDatasets, TaskDistributions, and MetaLearners. The API fully decouples data processing, construction of learning tasks (and their distributions), adaptation algorithms, and model architectures, and makes it easy to experiment with different combinations of these basic building blocks as well as add new components to the growing ecosystem. Additionally, the library features a suite of benchmarks that enable reproducibility. Everything is highly configurable through hydra.

The library is under active development. The latest documentation is available at: https://meta-blocks.readthedocs.io/.


Installation

MetaBlocks requires Python 3.5+ and TensorFlow 2.2+.

For typical use

We recommend using pip for installing the latest release of the library:

$ pip install meta-blocks            # normal install
$ pip install --upgrade meta-blocks  # or update if needed
$ pip install --pre meta-blocks      # or include pre-release version for new features

Alternatively, to install the latest version from the master branch:

$ git clone https://github.com/alshedivat/meta-blocks.git
$ pip install meta-blocks

Note: to be able to access and run benchmarks, you will need to clone the repository.

For development and contributions

You can install additional development requirements as follows:

$ pip install -r requirements/dev.txt

Also, please make sure to install pre-commit hooks to ensure proper code style and formatting:

$ pip install pre-commit      # install pre-commit
$ pre-commit install          # install git hooks
$ pre-commit run --all-files  # run pre-commit on all the files

Getting started & use cases

You can use the library as (1) a modular benchmarking suite or (2) a scaffold API for new learning-to-learn algorithms.

Benchmarking

To enable reproducible research, we maintain a suite of benchmarks/. To run a benchmark, simply clone the repo, change your working directory to the corresponding benchmark, and execute a run script. For example:

$ git clone https://github.com/alshedivat/meta-blocks.git
$ cd meta-blocks/benchmarks/omniglot
$ ./fetch_data                    # fetches data for the benchmark
$ ./run_classic_supervised.sh     # runs an experiment (train and eval routines in parallel)

For more details, please refer to benchmarks/README.md.

MetaBlocks API

MetaBlocks provides multiple layers of API implemented as a hierarchy of Python classes. The three major main components are MetaDataset, TaskDistribution, and MetaLearner:

  1. MetaDataset provides access to Dataset instances constructed from an underlying DataSource. Dataset represents a collection of data tensors (e.g., in case of multi-class classification, it is a collection of input tensors, one for each class).
  2. TaskDistribution further builds on top of MetaDataset and provides access to Task instances that specify the semantics of a learning task. E.g., a few-shot classification task provides access to non-overlapping support and query subsets of a Dataset. Task distributions determine how tasks are sampled and constructed. Currently, we support supervised and self-supervised tasks for few-shot classification.
  3. MetaLearner encapsulates a parametric model (your favorite neural net) and an adaptation algorithm used for adapting the model to new tasks. Adaptation algorithms must use the API exposed by the Task.

Note: decoupling tasks from datasets and (meta-)learning methods is one of the core advantages of meta-blocks over other libraries.

Below are the components currently supported by the library:

Component Supported Instances
MetaDataset Omniglot MiniImageNet ...
TaskDistribution Classic supervised Limited supervised Self-supervised ...
MetaLearner MAML [1] Reptile [2] Prototypical Networks [3] ...

Adding your own meta-datasets

To add your own meta-datasets, you need to subclass MetaDataset and implement a few methods.

[TODO: provide a detailed walk-through example.]

If the full data used to construct the meta-dataset is light and easily fits in the memory, you can follow the implementation of Omniglot. If the dataset is too large or requires some heavy preprocessing, the best way is to use tf.data.Dataset API. As a starting point, you can follow the miniImageNet implementation.

Adding your own meta-learners

To add your own meta-learning algorithms, you need to subclass MetaLearner and implement two methods: _get_adapted_model (must return an adapted model instance) and _build_adaptation (must build a part of the computation graph that adapts the model). Example: prototype-based adaptation builds prototypes from the support set inside _build_adaptation method and returns a model with the corresponding prototypes when _get_adapted_model is called.

[TODO: provide a detailed walk-through example.]


Citation

If you use meta-blocks for research, please cite it as follows.

@misc{metablocks,
  title={MetaBlocks: A modular toolbox for meta-learning research with a focus on speed and reproducibility.},
  year={2020},
  publisher={GitHub},
  journal={GitHub repository},
  howpublished={\url{https://github.com/alshedivat/meta-blocks}},
}

Related projects

A few notable related projects:

Project Description
Torchmeta A PyTorch library that implements multiple few-shot learning methods.
learn2learn A PyTorch library that supports meta-RL.

References

[1] Finn, C., Abbeel, P. and Levine, S. Model-agnostic meta-learning for fast adaptation of deep networks. ICML 2017.

[2] Nichol, A., Achiam, J. and Schulman, J. On first-order meta-learning algorithms. arXiv preprint arXiv:1803.02999.

[3] Snell, J., Swersky, K. and Zemel, R. Prototypical networks for few-shot learning. NeurIPS 2017.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].