• Stars
    star
    262
  • Rank 156,136 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created over 5 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An ML framework to accelerate research and its path to production.




Fast tests Slow tests Documentation Status PyPI version

Welcome to Flambé, a PyTorch-based library that allows users to:

  • Run complex experiments with multiple training and processing stages
  • Search over hyperparameters, and select the best trials
  • Run experiments remotely over many workers, including full AWS integration
  • Easily share experiment configurations, results, and model weights with others

Installation

From PIP:

pip install flambe

From source:

git clone [email protected]:asappresearch/flambe.git
cd flambe
pip install .

Getting started

Define an Experiment:

!Experiment

name: sst-text-classification

pipeline:

  # stage 0 - Load the Stanford Sentiment Treebank dataset and run preprocessing
  dataset: !SSTDataset # this is a simple Python object, and the arguments to build it
    transform: # these arguments are passed to the init method
      text: !TextField
      label: !LabelField

  # Stage 1 - Define a model
  model: !TextClassifier
      embedder: !Embedder
        embedding: !torch.Embedding  # automatically use pytorch classes
          num_embeddings: !@ dataset.text.vocab_size # link to other components, and attributes
          embedding_dim: 300
        embedding_dropout: 0.3
        encoder: !PooledRNNEncoder
          input_size: 300
          n_layers: !g [2, 3, 4] # grid search over any parameters
          hidden_size: 128
          rnn_type: sru
          dropout: 0.3
      output_layer: !SoftmaxLayer
          input_size: !@ model[embedder][encoder].rnn.hidden_size # also use inner-links
          output_size: !@ dataset.label.vocab_size

  # Stage 2 - Train the model on the dataset
  train: !Trainer
    dataset: !@ dataset
    model: !@ model
    train_sampler: !BaseSampler
    val_sampler: !BaseSampler
    loss_fn: !torch.NLLLoss
    metric_fn: !Accuracy
    optimizer: !torch.Adam
      params: !@ train[model].trainable_params
    max_steps: 100
    iter_per_step: 100

  # Stage 3 - Eval on the test set
  eval: !Evaluator
    dataset: !@ dataset
    model: !@ train.model
    metric_fn: !Accuracy
    eval_sampler: !BaseSampler

# Define how to schedule variants
schedulers:
  train: !ray.HyperBandScheduler

All objects in the pipeline are subclasses of Component, which are automatically registered to be used with YAML. Custom Component implementations must implement run to add custom behavior when being executed.

Now just execute:

flambe example.yaml

Note that defining objects like model and dataset ahead of time is optional; it's useful if you want to reference the same model architecture multiple times later in the pipeline.

Progress can be monitored via the Report Site (with full integration with Tensorboard):

Features

  • Native support for hyperparameter search: using search tags (see !g in the example) users can define multi variant pipelines. More advanced search algorithms will be available in a coming release!
  • Remote and distributed experiments: users can submit Experiments to Clusters which will execute in a distributed way. Full AWS integration is supported.
  • Visualize all your metrics and meaningful data using Tensorboard: log scalars, histograms, images, hparams and much more.
  • Add custom code and objects to your pipelines: extend flambé functionality using our easy-to-use extensions mechanism.
  • Modularity with hierarchical serialization: save different components from pipelines and load them safely anywhere.

Next Steps

Full documentation, tutorials and much more in https://flambe.ai

Contact

You can reach us at [email protected]

More Repositories

1

sru

Training RNNs as Fast as CNNs (https://arxiv.org/abs/1709.02755)
Python
2,103
star
2

revisit-bert-finetuning

For the code release of our arXiv paper "Revisiting Few-sample BERT Fine-tuning" (https://arxiv.org/abs/2006.05987).
Python
184
star
3

wav2seq

Official code for Wav2Seq
Python
81
star
4

aum

Python
71
star
5

sew

Python
69
star
6

dialog-intent-induction

Code and data for paper "Dialog Intent Induction with Deep Multi-View Clustering", Hugh Perkins and Yi Yang, 2019, EMNLP 2019
Python
67
star
7

abcd

Official repository for "Action-Based Conversations Dataset: A Corpus for Building More In-Depth Task-Oriented Dialogue Systems"
Python
57
star
8

structshot

Simple and Effective Few-Shot Named Entity Recognition with Structured Nearest Neighbor Learning
Python
53
star
9

slue-toolkit

A toolkit for Spoken Language Understanding Evaluation (SLUE) benchmark. Refer paper https://arxiv.org/abs/2111.10367 for more details. Official website: https://asappresearch.github.io/slue-toolkit/
Python
47
star
10

rationale-alignment

Python
46
star
11

flop

Pytorch library for factorized L0-based pruning.
Python
39
star
12

multistream-cnn

Multistream CNN for Robust Acoustic Modeling
Shell
38
star
13

clip

Python
22
star
14

emergent-comms-negotiation

Reproduce ICLR2018 submission "Emergent Communication through Negotiation"
Python
16
star
15

interactive-classification

Python
13
star
16

dynamic-classification

Code from the paper: "Metric Learning for Dynamic Text Classification"
Python
11
star
17

kbc-pomr

Code for the paper "Knowledge Base Completion for Constructing Problem-Oriented Medical Records" at MLHC 2020
Python
10
star
18

gold

Official repository for "GOLD: Improving Out-of-Scope Detection in Dialogues using Data Augmentation"
Python
8
star
19

spoken-ner

Python
8
star
20

constrained-dialogue-generation

Python
5
star
21

texrel

Code for paper "TexRel: a Green Family of Datasets for Emergent Communications on Relations", Hugh Perkins, 2021 (https://arxiv.org/abs/2105.12804)
Python
3
star
22

compositional-inductive-bias

Code for paper "A Framework for Measuring Compositional Inductive Bias", Hugh Perkins, 2021 (https://arxiv.org/abs/2103.04180)
Python
2
star
23

imitkd

Python
1
star