https://github.com/gilad-rubin/hypster
HyPSTER - Configuration Framework for Optimizing AI & AI Systems
https://github.com/gilad-rubin/hypster
auto-ml generative-ai hyperparameter-optimization machine-learning
Last synced: 5 months ago
JSON representation
HyPSTER - Configuration Framework for Optimizing AI & AI Systems
- Host: GitHub
- URL: https://github.com/gilad-rubin/hypster
- Owner: gilad-rubin
- License: mit
- Created: 2019-06-08T09:09:43.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2025-09-04T12:36:54.000Z (10 months ago)
- Last Synced: 2025-09-04T14:37:13.311Z (10 months ago)
- Topics: auto-ml, generative-ai, hyperparameter-optimization, machine-learning
- Language: Python
- Homepage: https://gilad-rubin.gitbook.io/hypster
- Size: 9.97 MB
- Stars: 51
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
Hypster is a lightweight configuration framework for managing and optimizing AI & ML workflows
> ⚠️ Hypster is in active development and not yet battle-tested in production.
> If you’re gaining value and want to promote it to production, please reach out!
## Key Features
- 🐍 **Pythonic API**: Intuitive & minimal syntax that feels natural to Python developers
- 🪆 **Hierarchical, Conditional Configurations**: Support for nested and swappable configurations
- 📐 **Type Safety**: Built-in type hints and validation
- 🧪 **Hyperparameter Optimization Built-In**: Native, first-class optuna support
## Installation
You can install Hypster using uv:
```bash
uv add hypster
# optional HPO backend
uv add 'hypster[optuna]'
```
Or using pip:
```bash
pip install hypster
```
## Quick Start
Define a configuration function and instantiate it with overrides:
```python
from hypster import HP, instantiate
from llm import LLM
def llm_config(hp: HP):
model_name = hp.select(["gpt-4o-mini", "gpt-4o"], name="model_name")
temperature = hp.float(0.7, name="temperature", min=0.0, max=1.0)
max_tokens = hp.int(256, name="max_tokens", min=1, max=4096)
llm = LLM(model_name=model_name, temperature=temperature, max_tokens=max_tokens)
return llm
llm = instantiate(llm_config, values={"model_name": "gpt-4o-mini", "temperature": 0.3})
llm.invoke("How's your day going?")
```
## HPO with Optuna
```python
import optuna
from hypster.hpo.types import HpoInt, HpoFloat, HpoCategorical
from hypster.hpo.optuna import suggest_values
def objective(trial: optuna.Trial) -> float:
values = suggest_values(trial, config=model_cfg)
model = instantiate(model_cfg, values=values)
X, y = make_classification(
n_samples=400, n_features=20, n_informative=10, random_state=42
)
return cross_val_score(model, X, y, cv=3, n_jobs=-1).mean()
study = optuna.create_study(direction="maximize")
study.optimize(objective, n_trials=30)
```
## Inspiration
Hypster draws inspiration from Meta's [hydra](https://github.com/facebookresearch/hydra) and [hydra-zen](https://github.com/mit-ll-responsible-ai/hydra-zen) framework.
The API design is influenced by [Optuna's](https://github.com/optuna/optuna) "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](LICENSE) file for details.