Skip to main content

Pixeltable: The Multimodal AI Data Plane

Project description

Pixeltable

Unifying Data, Models, and Orchestration for AI Products

License PyPI - Python Version Platform Support pytest status PyPI Package

Installation | Documentation | API Reference | Code Samples | Examples

Pixeltable is a Python library that lets ML Engineers and Data Scientists focus on exploration, modeling, and app development without dealing with the customary data plumbing.

What problems does Pixeltable solve?

Today’s solutions for AI app development require extensive custom coding and infrastructure plumbing. Tracking lineage and versions between and across data transformations, models, and deployment is cumbersome.

💾 Installation

pip install pixeltable

[!IMPORTANT] Pixeltable is persistent. Unlike in-memory Python libraries such as Pandas, Pixeltable is a database. When working locally or against an hosted version of Pixeltable, use get_table at any time to retrieve an existing table.

💡 Getting Started

Learn how to create tables, populate them with data, and enhance them with built-in or user-defined transformations and AI operations.

Topic Notebook Topic Notebook
10-Minute Tour of Pixeltable Open In Colab Tables and Data Operations Open In Colab
User-Defined Functions (UDFs) Open In Colab Object Detection Models Open In Colab
Experimenting with Chunking (RAG) Open In Colab Working with External Files Open In Colab
Integrating with Label Studio Visit our documentation Audio/Video Transcript Indexing Open In Colab

🧱 Code Samples

Import media data into Pixeltable (videos, images, audio...)

import pixeltable as pxt

v = pxt.create_table('external_data.videos', {'video': pxt.VideoType()})

prefix = 's3://multimedia-commons/'
paths = [
    'data/videos/mp4/ffe/ffb/ffeffbef41bbc269810b2a1a888de.mp4',
    'data/videos/mp4/ffe/feb/ffefebb41485539f964760e6115fbc44.mp4',
    'data/videos/mp4/ffe/f73/ffef7384d698b5f70d411c696247169.mp4'
]
v.insert({'video': prefix + p} for p in paths)

Learn how to work with data in Pixeltable.

Add an object detection model to your workflow

table['detections'] = huggingface.detr_for_object_detection(table.input_image, model_id='facebook/detr-resnet-50')

Learn about computed columns and object detection: Comparing object detection models.

Extend Pixeltable's capabilities with user-defined functions

@pxt.udf
def draw_boxes(img: PIL.Image.Image, boxes: list[list[float]]) -> PIL.Image.Image:
    result = img.copy()  # Create a copy of `img`
    d = PIL.ImageDraw.Draw(result)
    for box in boxes:
        d.rectangle(box, width=3)  # Draw bounding box rectangles on the copied image
    return result

Learn more about user-defined functions: UDFs in Pixeltable.

Automate data operations with views

# In this example, the view is defined by iteration over the chunks of a DocumentSplitter.
chunks_table = pxt.create_view(
    'rag_demo.chunks',
    documents_table,
    iterator=DocumentSplitter.create(
        document=documents_table.document,
        separators='token_limit', limit=300)
)

Learn how to leverage views to build your RAG workflow.

Evaluate model performance

# The computation of the mAP metric can simply become a query over the evaluation output, aggregated with the mean_ap() function.
frames_view.select(mean_ap(frames_view.eval_yolox_tiny), mean_ap(frames_view.eval_yolox_m)).show()

Learn how to leverage Pixeltable for Model analytics.

Working with inference services

chat_table = pxt.create_table('together_demo.chat', {'input': pxt.StringType()})

# The chat-completions API expects JSON-formatted input:
messages = [{'role': 'user', 'content': chat_table.input}]

# This example shows how additional parameters from the Together API can be used in Pixeltable to customize the model behavior.
chat_table['output'] = chat_completions(
    messages=messages,
    model='mistralai/Mixtral-8x7B-Instruct-v0.1',
    max_tokens=300,
    stop=['\n'],
    temperature=0.7,
    top_p=0.9,
    top_k=40,
    repetition_penalty=1.1,
    logprobs=1,
    echo=True
)
chat_table['response'] = chat_table.output.choices[0].message.content

# Start a conversation
chat_table.insert([
    {'input': 'How many species of felids have been classified?'},
    {'input': 'Can you make me a coffee?'}
])
chat_table.select(chat_table.input, chat_table.response).head()

Learn how to interact with inference services such as Together AI in Pixeltable.

❓ FAQ

What is Pixeltable?

Pixeltable unifies data storage, versioning, and indexing with orchestration and model versioning under a declarative table interface, with transformations, model inference, and custom logic represented as computed columns.

What does Pixeltable provide me with? Pixeltable provides:

  • Data storage and versioning
  • Combined Data and Model Lineage
  • Indexing (e.g. embedding vectors) and Data Retrieval
  • Orchestration of multimodal workloads
  • Incremental updates
  • Code is automatically production-ready

Why should you use Pixeltable?

  • It gives you transparency and reproducibility
    • All generated data is automatically recorded and versioned
    • You will never need to re-run a workload because you lost track of the input data
  • It saves you money
    • All data changes are automatically incremental
    • You never need to re-run pipelines from scratch because you’re adding data
  • It integrates with any existing Python code or libraries
    • Bring your ever-changing code and workloads
    • You choose the models, tools, and AI practices (e.g., your embedding model for a vector index); Pixeltable orchestrates the data

What is Pixeltable not providing?

  • Pixeltable is not a low-code, prescriptive AI solution. We empower you to use the best frameworks and techniques for your specific needs.
  • We do not aim to replace your existing AI toolkit, but rather enhance it by streamlining the underlying data infrastructure and orchestration.

[!TIP] Check out the Integrations section, and feel free to submit a request for additional ones.

🐛 Contributions & Feedback

Are you experiencing issues or bugs with Pixeltable? File an Issue.
Do you want to contribute? Feel free to open a PR.

:classical_building: License

This library is licensed under the Apache 2.0 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pixeltable-0.2.16.tar.gz (227.1 kB view details)

Uploaded Source

Built Distribution

pixeltable-0.2.16-py3-none-any.whl (283.3 kB view details)

Uploaded Python 3

File details

Details for the file pixeltable-0.2.16.tar.gz.

File metadata

  • Download URL: pixeltable-0.2.16.tar.gz
  • Upload date:
  • Size: 227.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.9.19 Darwin/23.4.0

File hashes

Hashes for pixeltable-0.2.16.tar.gz
Algorithm Hash digest
SHA256 40562b6e6975714628eab13998fcb4bb24849509231391cc6a90e079d3698f8b
MD5 9072d7c45f7c3782709f5c708fbdfc4f
BLAKE2b-256 81f5bb163d169897aefaf8111ef11d1ccfdf994712a1442242cc19ac40f19e26

See more details on using hashes here.

File details

Details for the file pixeltable-0.2.16-py3-none-any.whl.

File metadata

  • Download URL: pixeltable-0.2.16-py3-none-any.whl
  • Upload date:
  • Size: 283.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.9.19 Darwin/23.4.0

File hashes

Hashes for pixeltable-0.2.16-py3-none-any.whl
Algorithm Hash digest
SHA256 0d3fc24b263567a651cd209dc3a034523c2e915e4c2cf810d91b6527b22e00ff
MD5 5bfa9c0d6bfed5a71a4da0c7fda78d4b
BLAKE2b-256 4f05ee486ef6f559b6667043a73d8dc215d4aaecfea6ab4aea1361bda1d6dd28

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page