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 high-quality synthetic datasets using simple templates

  • Quality enhancement with RAG from Internet and local files

  • Data anonymization

  • Data evaluation & cleaning agent

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

  • (SOON) Multimodality

Installation

pip install --upgrade opendatagen

Setting up the OpenAI API key (using openai>=1.2)

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: Generate a dataset of Python exercises using a template

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

# 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,
            model_name="gpt-3.5-turbo-1106"
        )
    },
    completion_variables={
        "python_code": Variable(
            name="Python code",
            temperature=0,
            max_tokens=256,
            generation_number=1,
            model_name="gpt-4"
        )
    }
)

#Or you can load your templates from a json file
#from opendatagen.template import TemplateManager
#user_template = TemplateManager("files/template.json")
#Note: you can find examples of json at https://github.com/thoddnn/open-datagen/blob/main/opendatagen/files/template.json

generator = DataGenerator(template=user_template)

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

print(data)

Once created, you can ask an AI Agent to evaluate and correct your dataset

from opendatagen.agent import DataAgent

agent = DataAgent()
    
agent.run()

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 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.14.tar.gz (21.3 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.14-py3-none-any.whl (35.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: opendatagen-0.0.14.tar.gz
  • Upload date:
  • Size: 21.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for opendatagen-0.0.14.tar.gz
Algorithm Hash digest
SHA256 cb28905cf29af5b03260240417113c2935a5e9023482423f966b24d62e35b46d
MD5 8270a9243343dfc94871875864b3bcc2
BLAKE2b-256 a1361388683f7df2a5404afa8412c4b787cdb4a3c3810015aa57ed503ab729bf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: opendatagen-0.0.14-py3-none-any.whl
  • Upload date:
  • Size: 35.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for opendatagen-0.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 83fe482a84d9efabfb806498e7a3188fd1721c409e4d06d000c1bcee04fdcc7b
MD5 797894cd199a488a7ee536d82a3f0f89
BLAKE2b-256 b97a296ba2d796d8d96fda23b880b90da0eed0a1501a8b9afbad2e95167188dd

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