This release is a pre-release and may not be stable for production use.
distribatch
Batch model inference over DataFrames: LLM generation, text embeddings and speech transcription, on Databricks or anywhere Python runs.
import distribatch as dib
from pydantic import BaseModel
class Sentiment(BaseModel):
label: str
confidence: float
job = dib.GenerateJob(
model=dib.models.databricks("databricks-meta-llama-3-3-70b-instruct"),
prompt="Classify the sentiment of this review:\n{review}",
output_schema=Sentiment,
)
scored = job.run(reviews_df, backend="spark", output_col="sentiment")
- One job, three backends:
local,multiprocessing(one worker per GPU) andspark(mapInArrow, also on Spark Connect / serverless). - Any model source: Unity Catalog registered models, Hugging Face weights in a directory or UC Volume, or any OpenAI-compatible API (OpenAI, Databricks Model Serving, vLLM servers, …).
- Engines: vLLM on GPUs, Hugging Face transformers on CPU/GPU, faster-whisper for speech, and an async OpenAI client with retries, rate limits and concurrency control.
- Built for long runs:
- per-row errors instead of failed jobs;
- structured output validated against pydantic models and typed as Spark structs;
- checkpoints that resume where a run stopped;
- deduplication of identical inputs;
- run statistics with cost estimates.
Installation
pip install "distribatch[openai]" # APIs and Databricks Model Serving
pip install "distribatch[vllm,mlflow]" # self-hosted LLMs/embedders from Unity Catalog
pip install "distribatch[whisper,transformers,audio]" # local speech-to-text
pip install "distribatch[all]"
Python 3.10+. The core install is light: heavy dependencies come with the extras and are imported only when used.
Embeddings and transcription
vectors = dib.EmbedJob(
model=dib.models.path("/Volumes/main/ml/weights/bge-m3", copy_to_local=True),
text="{title}\n\n{body}",
normalize=True,
).run(docs_df, backend="spark", output_col="embedding") # array<float>
calls = spark.read.format("binaryFile").load("/Volumes/main/raw/calls/").select("path")
transcripts = dib.TranscribeJob(
model=dib.models.uc("main.audio.whisper_large_v3", alias="prod"),
audio_col="path",
timestamps=True,
).run(calls, backend="spark", output_col="transcript")
Long runs
out = job.run(
reviews_df,
backend="spark",
checkpoint="/Volumes/main/ml/checkpoints/reviews", # resume after interruptions
id_col="review_id",
dedupe=True, # identical inputs sent once
)
stats = dib.summarize(out, output_col="sentiment")
print(stats) # success rate, errors, tokens, latency
print(stats.cost(input_per_million=0.5, output_per_million=1.5))
On a single machine use backend="multiprocessing". In plain Python scripts, put the
call under if __name__ == "__main__":, because worker processes are spawned.
Documentation
The wiki covers every job, engine
option and backend, plus the output contract, checkpoints, a Databricks guide
(credentials, GPU clusters, Unity Catalog) and troubleshooting. Runnable examples are in
examples/.
Status: pre-1.0. The API may still change between minor versions, see CHANGELOG.md.
License
Apache-2.0
Metadata
Release files for distribatch 0.1.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| distribatch-0.1.0a1.tar.gz | 86.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| distribatch-0.1.0a1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 161.3 kB
Release files / distribatch-0.1.0a1.tar.gz
| Download URL | distribatch-0.1.0a1.tar.gz |
|---|---|
| Size | 86.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
239d26e0af8c7c94aed7fbb62fbf8ec2b0c9554b3a639e63d8f1d720b1ba3db9
|
|
BLAKE2b-256 checksum How to use checksums |
83f7cbe2ef4640af2d9fc530434738b716a57c3ae8aed4712bd401c38d319639
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / distribatch-0.1.0a1-py3-none-any.whl
| Download URL | distribatch-0.1.0a1-py3-none-any.whl |
|---|---|
| Size | 74.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
22070993fd2886dda04b72f924f0c8e755f6fdb1243ff64bbc7e4062ba879dfc
|
|
BLAKE2b-256 checksum How to use checksums |
393d18ff21f38527474be63a31dfc0211b154f8cbd47b0477f36c5650a242869
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency log