Skip to main content

Create synthetic datasets with LLM generators and samplers

Project description

Examples

Prompt a dataset

import chatan

gen = chatan.generator.client("YOUR_OPENAI_API_KEY")
ds = chatan.dataset("create a QA dataset for finetuning an LLM on pharmacology")

Creating datasets with different data mixes

import uuid
from chatan import dataset, generator, mix

gen = generator.client("YOUR_OPENAI_API_KEY")
#generator.client("anthropic", "YOUR_ANTHROPIC_API_KEY")

mix = {
    "implementation": "Can you implement a matmul kernel in Triton",
    "conversion": "Convert this pytorch model to Triton",
    "explanation": "What memory access optimizations are being used here?"
}

ds = dataset({
    "id": uuid,
    "task": sample.choice(mix),
    "prompt": gen("write a prompt for {task}"),
    "response": gen("write a response to {prompt}"),
)}

Augment datasets

import uuid
from chatan import dataset, generator
from dataset import load_dataset

gen = generator.client("YOUR_OPENAI_API_KEY")
hf_dataset = load_dataset("GPU_MODE/KernelBook")

ds = dataset({
    "id": sample.from_dataset(hf_data, "id", default=sample.uuid()),
    "prompt": sample.from_dataset(hf_data, "prompt", aug=gen("provide a variation of this prompt")),
    "response": gen("write a response to {prompt}")

})

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

chatan-0.1.1.tar.gz (230.6 kB view details)

Uploaded Source

Built Distribution

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

chatan-0.1.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file chatan-0.1.1.tar.gz.

File metadata

  • Download URL: chatan-0.1.1.tar.gz
  • Upload date:
  • Size: 230.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.8

File hashes

Hashes for chatan-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a4c7f16d16c5132033c2af303e10572ca5c36557461465cd32241ffcfb079644
MD5 dcd2002105405a801ebeadb75343dfc1
BLAKE2b-256 8d7fedf1d4f741fa0060ed62fd44e85c029f0b6adfd70e84ad36a848df91b9b3

See more details on using hashes here.

File details

Details for the file chatan-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: chatan-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.8

File hashes

Hashes for chatan-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d6ed4c169757ea877cc17db183a91f4a8f05e6a7981e64ebbdf054ab6846f94c
MD5 9759444038bb68c40d4f0bdedf5c624b
BLAKE2b-256 8cbd17f3be49b674ca6a2e73f6f64d49d59da3ddf870895e8318e6eeba6aa70c

See more details on using hashes here.

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