Flambé:基于PyTorch面向研究和产品化加速的机器学习实验框架

网友投稿 606 2022-11-04

Flambé:基于PyTorch面向研究和产品化加速的机器学习实验框架

Flambé:基于PyTorch面向研究和产品化加速的机器学习实验框架

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

Run complex experiments with multiple training and processing stagesSearch over hyperparameters, and select the best trialsRun experiments remotely over many workers, including full AWS integrationEasily share experiment configurations, results, and model weights with others

Installation

From PIP:

pip install flambe

From source:

git clone git@github.com:asappresearch/flambe.gitcd flambepip install .

Getting started

Define an Experiment:

!Experimentname: sst-text-classificationpipeline: # 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 variantsschedulers: 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 flambe@asapp.com

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:24. Django 视图 - HttpResponse、JsonResponse、HttpResponseRedirect
下一篇:mqant是一个基于Golang语言的高性能分布式游戏服务器框架
相关文章

 发表评论

暂时没有评论,来抢沙发吧~