Skip to main content

Steerable data generation system for LLM fine-tuning

Project description

⬜️ Open Datagen ⬜️

Open Datagen, a steerable data generation system for ML models training.

Features

  • Generate synthetic datasets with a fixed format using:

    • User-defined template with pydantic object
    • Predefined templates
  • Data anonymization

  • Quality enhancement with RAG from Internet and local files

  • (SOON) Data evaluation & cleaning agent

  • (SOON) Open-source model support (+ local inference)

  • (SOON) Multimodality

Installation

pip install --upgrade opendatagen

Setting up the OpenAI API key

export OPENAI_API_KEY='your_openai_api_key'

Setting up the SERPLY API key for Google Search API (optional)

export SERPLY_API_KEY='your_serply_api_key'

Usage

Example: If you want to train a small model to write great python code

from opendatagen.data_generator import DataGenerator
from opendatagen.model import LLM
from opendatagen.template import Template, Variable

variation_model = LLM.load_chat.GPT_35_TURBO_CHAT 
completion_model = LLM.load_instruct.GPT_35_TURBO_INSTRUCT

# Create the custom template using the Pydantic models
user_template = Template(
    description="Custom template for Python exercises",
    prompt="Python exercice statement: {python_exercice_statement}",
    completion="Answer:\n{python_code}",
    prompt_variation_number=1,
    prompt_variables={
        "python_exercice_statement": Variable(
            name="Python exercice statement",
            temperature=1,
            max_tokens=120,
            generation_number=10
        )
    },
    completion_variables={
        "python_code": Variable(
            name="Python code",
            temperature=0,
            max_tokens=256,
            generation_number=1
        )
    }
)

generator = DataGenerator(template=user_template, variation_model=variation_model, completion_model=completion_model)

data = generator.generate_data(output_path="output.csv")

print(data)

This code will generate a dataset of 5 medium-level Python exercises/answers formatted as you asked for.

Predefined Templates:

from opendatagen.data_generator import DataGenerator
from opendatagen.model import LLM
from opendatagen.template import TemplateManager, TemplateName

variation_model = LLM.load_chat.GPT_35_TURBO_CHAT
completion_model = LLM.load_instruct.GPT_35_TURBO_INSTRUCT

manager = TemplateManager()
template = manager.get_template(TemplateName.PRODUCT_REVIEW)

generator = DataGenerator(template=template, variation_model=variation_model, completion_model=completion_model)

data = generator.generate_data(output_path="output.csv")

print(data)

You can find the templates in the template.json file.

Contribution

We welcome contributions to Open Datagen! Whether you're looking to fix bugs, add templates, new features, or improve documentation, your help is greatly appreciated.

Note

Please note that opendatagen is initially powered by OpenAI's models. Be aware of potential biases and use the start_with and note field to guide outputs.

Acknowledgements

We would like to express our gratitude to the following open source projects and individuals that have inspired and helped us:

Connect

Reach us on Twitter: @thoddnn.

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

opendatagen-0.0.12.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

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

opendatagen-0.0.12-py3-none-any.whl (31.4 kB view details)

Uploaded Python 3

File details

Details for the file opendatagen-0.0.12.tar.gz.

File metadata

  • Download URL: opendatagen-0.0.12.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.29.0 requests-toolbelt/0.10.1 urllib3/1.26.15 tqdm/4.50.2 importlib-metadata/5.1.0 keyring/21.4.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.8.5

File hashes

Hashes for opendatagen-0.0.12.tar.gz
Algorithm Hash digest
SHA256 5c97d4aa8b52bbdf12e03872c5135717e837afec33c3dacf160cada8ade4774e
MD5 537240beddd6236e77e5db75876c0ba8
BLAKE2b-256 0012561bd2952cbb9a3a7f0c081e9fd94737c897846313e3db5a292b792fbefa

See more details on using hashes here.

File details

Details for the file opendatagen-0.0.12-py3-none-any.whl.

File metadata

  • Download URL: opendatagen-0.0.12-py3-none-any.whl
  • Upload date:
  • Size: 31.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.29.0 requests-toolbelt/0.10.1 urllib3/1.26.15 tqdm/4.50.2 importlib-metadata/5.1.0 keyring/21.4.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.8.5

File hashes

Hashes for opendatagen-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 f48a8ca2c57dfb58b1449f6684a50b7f949a68f7b451a0b2a988f088013e6794
MD5 0833129f27ac82e3648542f905b4aba7
BLAKE2b-256 805b1e1c09ac60277e37394d91366c5db098f1054e4e45fb80abe083bae17e18

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