Config
Config
dataclass
Configuration class for the promptolution library.
This class handles loading and parsing of configuration settings, either from a config file or from keyword arguments.
Attributes:
Name | Type | Description |
---|---|---|
task_name |
str
|
Name of the task. Should not be None if used. |
ds_path |
str
|
Path to the dataset. Should not be None if used. |
n_steps |
int
|
Number of optimization steps. Should not be None if used. |
optimizer |
str
|
Name of the optimizer to use. Should not be None if used. |
predictor |
str
|
Name of the predictor to use. Defaults to "FirstOccurenceClassificator". |
meta_llm |
str
|
Name of the meta language model. Should not be None if used. |
downstream_llm |
str
|
Name of the downstream language model. Should not be None if used. |
evaluation_llm |
str
|
Name of the evaluation language model. Should not be None if used. |
init_pop_size |
int
|
Initial population size. Defaults to 10. |
initial_prompts |
List[str]
|
Initial prompts for the optimizer. Defaults to None. |
logging_dir |
str
|
Directory for logging. Defaults to "logs/run.csv". |
experiment_name |
str
|
Name of the experiment. Defaults to "experiment". |
task_description |
str
|
Task Description fed to the optimizer. Defaults to None. |
donor_random |
bool
|
Whether to use random donor prompts for EvoPromptDE. Defaults to False. |
random_seed |
int
|
Random seed for reproducibility. Defaults to 42. |
model_storage_path |
str
|
Path to the model storage directory (used for VLLM). Defaults to "../models/". |
selection_mode |
str
|
Selection mode for EvoPromptGA. Defaults to "random". |
meta_bs |
int
|
Batch size for local meta LLM. Should not be None if llm is run locally. Defaults to None. |
downstream_bs |
int
|
Batch size for local downstream LLM. |
api_token |
str
|
API token for different APIs, as implemented in LLM classes. |
meta_prompt |
str
|
Prompt template for the meta LLM. |
prepend_exemplars |
bool
|
rather to do exemplar search and prepend few-shot examples. Defaults to False. |
n_exemplars |
int
|
how many exemplars to prepend. Only used if prepend_exemplars is True. Defaults to 5. |
exemplar_selector |
str
|
which exemplar selector to use. Should not be None if preped_exemplars is True. |
n_ds_samples_to_meta |
int
|
how many examples to show of the ds to show to meta-llm |
n_eval_samples |
int
|
how many examples to show to evaluation llm for evaluation. |
Source code in promptolution/config.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
|
api_token = None
class-attribute
instance-attribute
donor_random = False
class-attribute
instance-attribute
downstream_bs = None
class-attribute
instance-attribute
downstream_llm = None
class-attribute
instance-attribute
ds_path = None
class-attribute
instance-attribute
evaluation_llm = None
class-attribute
instance-attribute
exemplar_selector = None
class-attribute
instance-attribute
experiment_name = 'experiment'
class-attribute
instance-attribute
init_pop_size = None
class-attribute
instance-attribute
initial_prompts = None
class-attribute
instance-attribute
logging_dir = Path('logs/run.csv')
class-attribute
instance-attribute
meta_bs = None
class-attribute
instance-attribute
meta_llm = None
class-attribute
instance-attribute
meta_prompt = None
class-attribute
instance-attribute
model_storage_path = Path('../models/')
class-attribute
instance-attribute
n_ds_samples_to_meta = 2
class-attribute
instance-attribute
n_eval_samples = 20
class-attribute
instance-attribute
n_exemplars = 5
class-attribute
instance-attribute
n_steps = None
class-attribute
instance-attribute
optimizer = None
class-attribute
instance-attribute
predictor = 'FirstOccurenceClassificator'
class-attribute
instance-attribute
prepend_exemplars = False
class-attribute
instance-attribute
random_seed = 42
class-attribute
instance-attribute
selection_mode = 'random'
class-attribute
instance-attribute
task_description = None
class-attribute
instance-attribute
task_name = None
class-attribute
instance-attribute
__init__(task_name=None, ds_path=None, optimizer=None, predictor='FirstOccurenceClassificator', meta_llm=None, downstream_llm=None, evaluation_llm=None, n_steps=None, init_pop_size=None, initial_prompts=None, logging_dir=Path('logs/run.csv'), experiment_name='experiment', task_description=None, donor_random=False, random_seed=42, model_storage_path=Path('../models/'), selection_mode='random', meta_bs=None, downstream_bs=None, api_token=None, meta_prompt=None, prepend_exemplars=False, n_exemplars=5, exemplar_selector=None, n_ds_samples_to_meta=2, n_eval_samples=20)
__post_init__()
from_dict(config_dict)
classmethod
from_file(config_path)
classmethod
Create a Config instance from a configuration file.