Skip to main content

A flexible configuration system for Python projects

Project description

Hypster Logo

[Documentation] | [Installation] | [Quick Start]

Hypster is a lightweight configuration system for AI & Machine Learning projects. It offers minimal, intuitive pythonic syntax, supporting hierarchical and swappable configurations.

Installation

You can install Hypster using pip:

pip install hypster

Quick Start

Here's a simple example of how to use Hypster:

from hypster import HP, config

@config
def my_config(hp: HP):
    chunking_strategy = hp.select(['paragraph', 'semantic', 'fixed'], default='paragraph')

    llm_model = hp.select({'haiku': 'claude-3-haiku-20240307',
                           'sonnet': 'claude-3-5-sonnet-20240620',
                           'gpt-4o-mini': 'gpt-4o-mini'}, default='gpt-4o-mini')

    llm_config = {'temperature': hp.number_input(0),
                  'max_tokens': hp.number_input(64)}

    system_prompt = hp.text_input('You are a helpful assistant. Answer with one word only')

Now we can instantiate the configs with our selections and overrides:

results = my_config(final_vars=["chunking_strategy", "llm_config", "llm_model"],
                    selections={"llm_model" : "haiku"},
                    overrides={"llm_config.temperature" : 0.5})

Inspiration

Hypster draws inspiration from Meta's hydra and hydra-zen framework. The API design is influenced by Optuna's "define-by-run" API.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

hypster-0.2.13.tar.gz (20.5 kB view hashes)

Uploaded Source

Built Distribution

hypster-0.2.13-py3-none-any.whl (23.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page