{"id":13534486,"url":"https://github.com/analysiscenter/batchflow","last_synced_at":"2025-10-25T23:24:27.097Z","repository":{"id":38860679,"uuid":"84835419","full_name":"analysiscenter/batchflow","owner":"analysiscenter","description":"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.","archived":false,"fork":false,"pushed_at":"2024-10-29T09:44:06.000Z","size":159297,"stargazers_count":200,"open_issues_count":36,"forks_count":46,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-10-29T11:42:31.217Z","etag":null,"topics":["data-science","machine-learning","pipeline","pipeline-framework","python","python3","workflow","workflow-engine"],"latest_commit_sha":null,"homepage":"https://analysiscenter.github.io/batchflow/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/analysiscenter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-13T14:22:53.000Z","updated_at":"2024-10-29T09:44:09.000Z","dependencies_parsed_at":"2024-01-15T11:48:31.845Z","dependency_job_id":"43136d6c-2b5f-4fe4-85bc-0ecef2e9f846","html_url":"https://github.com/analysiscenter/batchflow","commit_stats":{"total_commits":4457,"total_committers":39,"mean_commits":"114.28205128205128","dds":0.5963652681175678,"last_synced_commit":"a81cddc0d4ec514c23812fc045d3f3889d558ba0"},"previous_names":["analysiscenter/dataset"],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/analysiscenter%2Fbatchflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/analysiscenter%2Fbatchflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/analysiscenter%2Fbatchflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/analysiscenter%2Fbatchflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/analysiscenter","download_url":"https://codeload.github.com/analysiscenter/batchflow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246720618,"owners_count":20822924,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-science","machine-learning","pipeline","pipeline-framework","python","python3","workflow","workflow-engine"],"created_at":"2024-08-01T07:01:34.210Z","updated_at":"2025-10-25T23:24:27.073Z","avatar_url":"https://github.com/analysiscenter.png","language":"Python","funding_links":[],"categories":["Python","Data Pipeline","数据管道和流处理","Data Pipelines \u0026 Streaming"],"sub_categories":[],"readme":"[![License](https://img.shields.io/github/license/analysiscenter/batchflow.svg)](https://www.apache.org/licenses/LICENSE-2.0)\n[![Python](https://img.shields.io/badge/python-3.10-blue.svg)](https://python.org)\n[![PyTorch](https://img.shields.io/badge/PyTorch-2.0-orange.svg)](https://pytorch.org)\n[![codecov](https://codecov.io/gh/analysiscenter/batchflow/branch/master/graph/badge.svg)](https://codecov.io/gh/analysiscenter/batchflow)\n[![PyPI](https://badge.fury.io/py/batchflow.svg)](https://badge.fury.io/py/batchflow)\n[![Status](https://github.com/analysiscenter/batchflow/actions/workflows/status.yml/badge.svg?branch=master)](https://github.com/analysiscenter/batchflow/actions?query=workflow%3Astatus)\n\n\n# BatchFlow\n\n`BatchFlow` helps you conveniently work with random or sequential batches of your data\nand define data processing and machine learning workflows even for datasets that do not fit into memory.\n\nFor more details see [the documentation and tutorials](https://analysiscenter.github.io/batchflow/).\n\nMain features:\n- flexible batch generaton\n- deterministic and stochastic pipelines\n- datasets and pipelines joins and merges\n- data processing actions\n- flexible model configuration\n- within batch parallelism\n- batch prefetching\n- ready to use ML models and proven NN architectures\n- convenient layers and helper functions to build custom models\n- a powerful research engine with parallel model training and extended experiment logging.\n\n## Basic usage\n\n```python\nmy_workflow = my_dataset.pipeline()\n              .load('/some/path')\n              .do_something()\n              .do_something_else()\n              .some_additional_action()\n              .save('/to/other/path')\n```\nThe 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:\n```python\nmy_workflow.run(BATCH_SIZE, shuffle=True, n_epochs=5)\n```\nor\n```python\nfor batch in my_workflow.gen_batch(BATCH_SIZE, shuffle=True, n_epochs=5):\n    # only now the actions are fired and data is being changed with the workflow defined earlier\n    # actions are executed one by one and here you get a fully processed batch\n```\nor\n```python\nNUM_ITERS = 1000\nfor i in range(NUM_ITERS):\n    processed_batch = my_workflow.next_batch(BATCH_SIZE, shuffle=True, n_epochs=None)\n    # only now the actions are fired and data is changed with the workflow defined earlier\n    # actions are executed one by one and here you get a fully processed batch\n```\n\n\n## Train a neural network\n`BatchFlow` includes ready-to-use proven architectures like VGG, Inception, ResNet and many others.\nTo apply them to your data just choose a model, specify the inputs (like the number of classes or images shape)\nand call `train_model`. Of course, you can also choose a loss function, an optimizer and many other parameters, if you want.\n```python\nfrom batchflow.models.torch import ResNet34\n\nmy_workflow = my_dataset.pipeline()\n              .init_model('model', ResNet34, config={'loss': 'ce', 'classes': 10})\n              .load('/some/path')\n              .some_transform()\n              .another_transform()\n              .train_model('ResNet34', inputs=B.images, targets=B.labels)\n              .run(BATCH_SIZE, shuffle=True)\n```\n\nFor more advanced cases and detailed API see [the documentation](https://analysiscenter.github.io/batchflow/).\n\n\n## Installation\n\n\u003e `BatchFlow` module is in the beta stage. Your suggestions and improvements are very welcome.\n\n\u003e `BatchFlow` supports Python 3.9 or higher.\n\n### Stable python package\n\nWith [uv](https://docs.astral.sh/uv/)\n```\nuv add batchflow\n```\n\nWith [poetry](https://python-poetry.org/)\n```\npoetry add batchflow\n```\n\nWith old-fashioned [pip](https://pip.pypa.io/en/stable/)\n```\npip3 install batchflow\n```\n\n### Development version\n\nWith [uv](https://docs.astral.sh/uv/)\n```\ngit clone --branch my_branch https://github.com/analysiscenter/batchflow\nuv add --editable ./batchflow\n```\n\nYou can skip `--branch` if you need `master`.\n\nWith [poetry](https://python-poetry.org/)\n```\npoetry add --editable git+https://github.com/analysiscenter/batchflow#my_branch\n```\n\nWith old-fashioned [pip](https://pip.pypa.io/en/stable/)\n```\ngit clone --branch my_branch https://github.com/analysiscenter/batchflow\npip install --editable ./batchflow\n```\n\n### Extras\nSome `batchflow` functions and classed require additional dependencies.\nIn order to use that functionality you might need to install `batchflow` with extras (e.g. `batchflow[nn]`):\n\n- image - working with image datasets and plotting\n- nn - for neural networks (includes torch, torchvision, ...)\n- datasets - loading standard datasets (MNIST, CIFAR, ...)\n- profile - performance profiling\n- jupyter - utility functions for notebooks\n- research - multiprocess research\n- telegram - for monitoring pipelines via a telegram bot\n- dev - batchflow development (ruff, pytest, ...)\n\nYou can install several extras at once, like `batchflow[image,nn,research]`.\n\n\n## Projects based on BatchFlow\n- [SeismiQB](https://github.com/GeoscienceML/seismiqb) - ML for seismic interpretation\n- [SeismicPro](https://github.com/GeoscienceML/SeismicPro) - ML for seismic processing\n- [PyDEns](https://github.com/analysiscenter/pydens) - DL Solver for ODE and PDE\n- [RadIO](https://github.com/analysiscenter/radio) - ML for CT imaging\n- [CardIO](https://github.com/analysiscenter/cardio) - ML for heart signals\n\n\n## Citing BatchFlow\nPlease cite BatchFlow in your publications if it helps your research.\n\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1041203.svg)](https://doi.org/10.5281/zenodo.1041203)\n\n```\nRoman Khudorozhkov et al. BatchFlow library for fast ML workflows. 2017. doi:10.5281/zenodo.1041203\n```\n\n```\n@misc{roman_kh_2017_1041203,\n  author       = {Khudorozhkov, Roman and others},\n  title        = {BatchFlow library for fast ML workflows},\n  year         = 2017,\n  doi          = {10.5281/zenodo.1041203},\n  url          = {https://doi.org/10.5281/zenodo.1041203}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanalysiscenter%2Fbatchflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanalysiscenter%2Fbatchflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanalysiscenter%2Fbatchflow/lists"}