Pyrallis - Simple Configuration with Dataclasses Pyrausta (also called pyrallis…
Rate quality
Private research annotation
Sign in to add a private research label or note.
- User
Pyrallis - Simple Configuration with Dataclasses Pyrausta (also called pyrallis (πυραλλίς), pyragones) is a mythological insect-sized dragon from Cyprus.
Pyrallis is a simple library, derived from simple-parsing and inspired by Hydra, for automagically creating project configuration from a dataclass.
GIF
Why pyrallis? With pyrallis your configuration is linked directly to your pre-defined dataclass, allowing you to easily create different configuration structures, including nested ones, using an object-oriented design. The parsed arguments are used to initialize your dataclass, giving you the typing hints and automatic code completion of a full dataclass object.
My First Pyrallis Example 👶 There are several key features to pyrallis but at its core pyrallis simply allows defining an argument parser using a dataclass.
from dataclasses import dataclass import pyrallis
@dataclass class TrainConfig: """ Training config for Machine Learning """ workers: int = 8 # The number of workers for training exp_name: str = 'default_exp' # The experiment name
def main(): cfg = pyrallis.parse(config_class=TrainConfig) print(f'Training {cfg.exp_name} with {cfg.workers} workers...') The arguments can then be specified using command-line arguments, a yaml configuration file, or both.
$ python train_model.py --config_path=some_config.yaml --exp_name=my_first_exp Training my_first_exp with 42 workers... Assuming the following configuration file
exp_name: my_yaml_exp workers: 42
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.