Skip to main content

Generate synthetic post-training datasets in TRL-native formats.

Project description

postsynth

Generate synthetic post-training datasets in TRL-native formats.

postsynth v1 focuses on conversational JSONL rows for common TRL workflows:

  • SFT: messages
  • DPO: prompt, chosen, rejected
  • GRPO: prompt
  • KTO: prompt, completion, label

Install

uv sync --dev

Configure OpenRouter

Set your key in the environment:

export OPENROUTER_API_KEY="..."

For local development, you can also create a .env file:

OPENROUTER_API_KEY=...

.env files are ignored by git.

CLI

Generate from a seed instruction:

postsynth generate sft \
  --seed "Customer-support chats about subscription billing." \
  --count 100 \
  --out data/generated/sft.jsonl

Generate from examples:

postsynth generate dpo \
  --examples examples/dpo.jsonl \
  --count 100 \
  --out data/generated/dpo.jsonl

The CLI writes a JSONL dataset and a sibling dataset card, for example sft.dataset.md, with non-secret generation metadata.

Python API

from postsynth import generate_sft

result = generate_sft(
    seed="Math tutoring conversations for middle-school students.",
    count=25,
    output_path="data/generated/math_sft.jsonl",
)

print(result.rows)

TRL Loading

from datasets import load_dataset

dataset = load_dataset("json", data_files="data/generated/sft.jsonl")

The generated rows follow the conversational formats documented by TRL: https://huggingface.co/docs/trl/en/dataset_formats

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

postsynth-0.1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

postsynth-0.1.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file postsynth-0.1.0.tar.gz.

File metadata

  • Download URL: postsynth-0.1.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for postsynth-0.1.0.tar.gz
Algorithm Hash digest
SHA256 95ceb159abbff189caa2dc7bd740850294f5f718adc253fcf522bb533328b0c6
MD5 03f410cea17e676328516108ad273d1c
BLAKE2b-256 aa46f705e61b4aa4c2a7dfbf5f1acb02768162ea01abef4c53d42021a1387e9d

See more details on using hashes here.

Provenance

The following attestation bundles were made for postsynth-0.1.0.tar.gz:

Publisher: publish.yml on wbrannock/postsynth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file postsynth-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: postsynth-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for postsynth-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d24ab09d7c40a33194e616f3ce714e83c3f5883df5038a0ab19eaa245fe6c28d
MD5 685ea9d4c9e2ece51420a7b0aa6b64de
BLAKE2b-256 fb5c9062d1e3c95c45c266048421329ab92f44cdcab760710311560623850a97

See more details on using hashes here.

Provenance

The following attestation bundles were made for postsynth-0.1.0-py3-none-any.whl:

Publisher: publish.yml on wbrannock/postsynth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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