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.0.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.0.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: chatan-0.0.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.0.1.tar.gz
Algorithm Hash digest
SHA256 cea83454fca1faf41e35a31d3d24c42f326ee0810ad0ab70f5b73b0fe84e0974
MD5 c764a24998a0fff8cad72999da1f3d3f
BLAKE2b-256 df6308a69efd020ce3f74f2d286e62e4e2d2f9ff194558a5d9d5817f8adcaeb7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chatan-0.0.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.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b7c61fa20cb53d86fc5a33331f41da8c22c0bc5586b7af7a20ce096abf66fbba
MD5 0892329336516712f05e7dbffb524535
BLAKE2b-256 7e035c01b26b4c73b74bbf4aff7fc8e3ebf8037e36a1c774bef55c5198c836bc

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