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.0.tar.gz (230.4 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.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for chatan-0.1.0.tar.gz
Algorithm Hash digest
SHA256 921ad93075a71cda365894ed26cca5bbc158920877711a9426baea2701ce231c
MD5 f7bfa2b55f95808d4f88158adce8ee27
BLAKE2b-256 eff22a056b376a530825e9e4d87963845c7256970808736f707d75d7716ab4e2

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for chatan-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cded20893198935f478a57317b9e4840863aeaa979e5077a812bde0b6a3f1697
MD5 d14cb1783a478ce01b8d2cd141ceb720
BLAKE2b-256 61b25217538d350b4680762e89fac2c8ea56cedd232270e8ab2ee382fe4d1ba6

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