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

  • Open-source model support (HuggingFace Inference API)

  • (SOON) Data decontamination

  • (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 OpenAIChatModel as 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.15.tar.gz (21.5 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.15-py3-none-any.whl (35.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: opendatagen-0.0.15.tar.gz
  • Upload date:
  • Size: 21.5 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.15.tar.gz
Algorithm Hash digest
SHA256 b226e725a331c4f2bd4545cfa995f4d4572b091504428d963bb0155da91a0489
MD5 a72eb3563a92213b7622cca3e9f48d9a
BLAKE2b-256 efc11576f84ddb70bac8a0a24d9ff5b7c8cdeaeff6fa6b0696dfe4d5bc17fd6d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: opendatagen-0.0.15-py3-none-any.whl
  • Upload date:
  • Size: 35.2 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.15-py3-none-any.whl
Algorithm Hash digest
SHA256 2fb3dbfe61f5d47520f29168f8fbd4335554b3a3255cf50bd8faf601d3a2f651
MD5 5c9f49d1f52c1b3734ba1789001316b3
BLAKE2b-256 6b1c876fdf8c3537f0d6ff4a16ba0ace75f5911bf700502eff550977eed21952

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