BatchFlow
helps you conveniently work with random or sequential batches of your data
and define data processing and machine learning workflows even for datasets that do not fit into memory.
For more details see the documentation and tutorials.
Main features:
my_workflow = my_dataset.pipeline() .load('/some/path') .do_something() .do_something_else() .some_additional_action() .save('/to/other/path')
The trick here is that all the processing actions are lazy. They are not executed until their results are needed, e.g. when you request a preprocessed batch:
my_workflow.run(BATCH_SIZE, shuffle=True, n_epochs=5)
or
for batch in my_workflow.gen_batch(BATCH_SIZE, shuffle=True, n_epochs=5): # only now the actions are fired and data is being changed with the workflow defined earlier # actions are executed one by one and here you get a fully processed batch
or
NUM_ITERS = 1000 for i in range(NUM_ITERS): processed_batch = my_workflow.next_batch(BATCH_SIZE, shuffle=True, n_epochs=None) # only now the actions are fired and data is changed with the workflow defined earlier # actions are executed one by one and here you get a fully processed batch
BatchFlow
includes ready-to-use proven architectures like VGG, Inception, ResNet and many others.
To apply them to your data just choose a model, specify the inputs (like the number of classes or images shape)
and call train_model
. Of course, you can also choose a loss function, an optimizer and many other parameters, if you want.
from batchflow.models.torch import ResNet34 my_workflow = my_dataset.pipeline() .init_model('model', ResNet34, config={'loss': 'ce', 'classes': 10}) .load('/some/path') .some_transform() .another_transform() .train_model('ResNet34', inputs=B.images, targets=B.labels) .run(BATCH_SIZE, shuffle=True)
For more advanced cases and detailed API see the documentation.
BatchFlow
module is in the beta stage. Your suggestions and improvements are very welcome.
BatchFlow
supports python 3.6 or higher.
With poetry
poetry add batchflow
With old-fashioned pip
pip3 install batchflow
With poetry
poetry add --editable git+https://github.com/analysiscenter/batchflow
With old-fashioned pip
pip install --editable git+https://github.com/analysiscenter/batchflow
Some batchflow
functions and classed require additional dependencies.
In order to use that functionality you might need to install batchflow
with extras (e.g. batchflow[nn]
):
You can install several extras at once, like batchflow[image,nn,research]
.
Please cite BatchFlow in your publications if it helps your research.
Roman Khudorozhkov et al. BatchFlow library for fast ML workflows. 2017. doi:10.5281/zenodo.1041203
@misc{roman_kh_2017_1041203,
author = {Khudorozhkov, Roman and others},
title = {BatchFlow library for fast ML workflows},
year = 2017,
doi = {10.5281/zenodo.1041203},
url = {https://doi.org/10.5281/zenodo.1041203}
}
全能AI智能助手,随时解答生活与工作的多样问题
问小白,由元石科技研发的AI智能助手,快速准确地解答各种生活和工作问题,包括但不限于搜索、规划和社交互动,帮助用户在日常生活中提高效率,轻松管理个人事务。
实时语音翻译/同声传译工具
Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让全世界的语言交流不再有国界。
一键生成PPT和Word,让学习生活更轻松
讯飞智 文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。