This release is a pre-release and may not be stable for production use.
tweaktune
tweaktune is a Rust-powered, Python-facing library designed to synthesize datasets for training and fine-tuning AI models, especially LMs (Language Models).
It allows you to easily build data pipelines, generate new examples using LLM APIs, and create structured datasets from a variety of sources.
Features
-
Flexible Data Sources:
Supports datasets from:- Parquet files
- CSV files
- JSONL files
- Arrow datasets
- OpenAPI specifications (for function calling datasets)
- Lists of tools (Python functions for function calling datasets)
- Pydantic models (for structured output datasets)
-
LLM Integration:
Connects to any LLM API to generate synthetic text or structured JSON. -
Dynamic Prompting:
Supports Jinja templates for highly customizable prompts. -
Parallel Processing:
Configure multiple workers to run your pipeline steps in parallel. -
Easy Pipeline Building:
Compose steps like sampling, generating, writing, or debugging into a seamless pipeline.
Quick Example
Here's how you can build a dataset from a Parquet file and synthesize new data using an LLM API:
from tweaktune import Pipeline
import os
persona_template = """
Na podstawie poniższego fragmentu tekstu opisz personę która jest z nim związana.
Dla opisywanej osoby wymyśl fikcyjne imię i nazwisko.
Napisz dwa zdania na temat tej osoby, opis zwróć w formacie json, nie dodawaj nic więcej:
{"persona":"opis osoby"}
---
FRAGMENT TEKSTU:
{{article[0].text}}
"""
url = "http://localhost:8000/"
api_key = os.environ["API_KEY"]
model = "model"
p = Pipeline()\
.with_workers(5)\
.with_parquet_dataset("web_articles", "../../datasets/articles.pq")\
.with_llm_api("bielik", url, api_key, model)\
.with_template("persona", persona_template)\
.with_template("output", """{"persona": {{persona|jstr}} }""")\
.iter_range(10000)\
.sample(dataset="web_articles", size=1, output="article")\
.generate_json(template="persona", llm="bielik", output="persona", json_path="persona")\
.write_jsonl(path="../../datasets/personas.jsonl", template="output")\
.run()
Pipeline Steps
You can easily chain together multiple steps:
sample()– sample items from a datasetread()– read entire datasetgenerate_text()– generate text using an LLMgenerate_json()– generate JSON output and extract a specific fieldwrite_jsonl()– write output to a JSONL filewrite_csv()– write output to a CSV fileprint()– print outputsdebug()– enable detailed debugginglog()– set log levelpython step– add custom Python-defined step classes
Why tweaktune?
- Build synthetic datasets faster for fine-tuning models.
- Automate text, JSON, or structured data generation.
- Stay flexible: plug your own LLM API or use existing OpenAI-compatible ones.
- Rust speed, Python usability.
📦 Installation
pip install tweaktune
🤝 Contributing
We welcome contributions! Feel free to open issues, suggest features, or create pull requests.
Please note that by contributing to this project, you agree to the terms of the Contributor License Agreement (CLA).
Metadata
Release files for tweaktune 0.0.1a12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tweaktune-0.0.1a12-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details for tweaktune-0.0.1a12-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
Release files / tweaktune-0.0.1a12-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | tweaktune-0.0.1a12-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 40.8 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
4145b4873f684d790e6318a102158b62ae62747d7da2d43e2715d4951f78e96e
|
|
BLAKE2b-256 checksum How to use checksums |
9d734c18f2748e2984167e04b82ca31e545c571a340ed0e575808d0c298b9ab2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.12
|
Security for tweaktune 0.0.1a12
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.