ml6team / fondant

Production-ready data processing made easy and shareable
https://fondant.ai/en/stable/
Apache License 2.0
329 stars 25 forks source link
data-processing fine-tuning foundation-models machine-learning pipeline python

Production-ready data processing made easy and shareable
Explore the docs ยป

Discord PyPI version License GitHub Workflow Status Coveralls


๐Ÿชค Why Fondant?

Fondant is a data framework that enables collaborative dataset building. It is designed for developing and crafting datasets together, sharing reusable operations and complete data processing trees.

Fondant enables you to initialize datasets, apply various operations on them, and load datasets from other users. It assists in executing operations on managed services, sharing operations with others, and keeping track of your dataset versions. Fondant makes this all possible without moving the source data.

๐Ÿ’จ Getting Started

Fondant allows you to easily define workflows comprised of both reusable and custom components. The following example uses the reusable load_from_hf_hub component to load a dataset from the Hugging Face Hub and process it using a custom component that will resize the images resulting in a new dataset.

import pyarrow as pa

from fondant.dataset import Dataset

# initialize a dataset by loading data from the Hugging Face Hub
raw_data = Dataset.create(
    "load_from_hf_hub",
    arguments={
        "dataset_name": "fondant-ai/fondant-cc-25m",
        "n_rows_to_load": 100,
    },
    produces={
        "alt_text": pa.string(),
        "image_url": pa.string(),
        "license_location": pa.string(),
        "license_type": pa.string(),
        "webpage_url": pa.string(),
        "surt_url": pa.string(),
        "top_level_domain": pa.string(),
    },
)
# add an operation to download the images from the urls
images = raw_data.apply(
    "download_images",
    arguments={
        "input_partition_rows": 100,
        "resize_mode": "no",
    },
)
# add an operation to resize the images
dataset = images.apply(
    "resize_images",
    arguments={
        "resize_width": 128,
        "resize_height": 128,
    },
)

Custom use cases require the creation of custom components. Check out our step by step guide to learn more about how to build custom pipelines and components.

(back to top)

Running your pipeline

Once you have a pipeline you can easily run (and compile) it by using the built-in CLI:

fondant run local pipeline.py

To see all available runners and arguments you can check the fondant CLI help pages

fondant --help

Or for a specific subcommand:

fondant <subcommand> --help

(back to top)

๐Ÿช„ How Fondant works

overview

(back to top)

๐Ÿงฉ Key Features

Here's what Fondant brings to the table:

๐Ÿ‘‰ Check our Component Hub for an overview of all available components

(back to top)

๐Ÿช„ Example pipelines

We have created several ready-made example pipelines for you to use as a starting point for exploring Fondant. They are hosted as separate repositories containing a notebook tutorial so you can easily clone them and get started:

๐Ÿ“– RAG tuning pipeline
End-to-end Fondant pipelines to index and evaluate RAG (Retrieval-Augmented Generation) systems.

๐Ÿ›‹๏ธ ControlNet Interior Design Pipeline
An end-to-end Fondant pipeline to collect and process data for the fine-tuning of a ControlNet model, focusing on images related to interior design.

๐Ÿ–ผ๏ธ Filter creative common license images
An end-to-end Fondant pipeline that starts from our Fondant-CC-25M creative commons image dataset and filters and downloads the desired images.

โš’๏ธ Installation

First, run the basic Fondant installation:

pip install fondant

Fondant also includes extra dependencies for specific runners, storage integrations and publishing components to registries. The dependencies for the local runner (docker) is included by default.

For more detailed installation options, check the installation pageon our documentation.

๐Ÿ‘ญ Contributing

We welcome contributions of different kinds:

Issues If you encounter any issue or bug, please submit them as a Github issue. You can also submit a pull request directly to fix any clear bugs.
Suggestions and feedback Our roadmap and priorities are defined based on community feedback. To provide input, you can join our discord or submit an idea in our Github Discussions.
Framework code contributions If you want to help with the development of the Fondant framework, have a look at the issues marked with the good first issue label. If you want to add additional functionality, please submit an issue for it first.
Reusable components Extending our library of reusable components is a great way to contribute. If you built a component which would be useful for other users, please submit a PR adding them to the components/ directory. You can find a list of possible contributable components here or your own ideas are also welcome!

For a detailed view on the roadmap and day to day development, you can check our github project board.

You can also check out our architecture page to familiarize yourself with the Fondant architecture and repository structure.

Environment setup

We use poetry and pre-commit to enable a smooth developer flow. Run the following commands to set up your development environment:

pip install poetry
poetry install --all-extras
pre-commit install

(back to top)