compressa-perf 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,208 @@
1
+ Metadata-Version: 2.1
2
+ Name: compressa-perf
3
+ Version: 0.1.0
4
+ Summary: Performance Measurement tool by Compresss
5
+ Author: Gleb Morgachev
6
+ Author-email: morgachev.g@gmail.com
7
+ Requires-Python: >=3.9,<4.0
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.9
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Requires-Dist: openai (>=1.47.1,<2.0.0)
14
+ Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
15
+ Requires-Dist: tabulate (>=0.9.0,<0.10.0)
16
+ Description-Content-Type: text/markdown
17
+
18
+ # Compressa Performance Measurement Tool
19
+
20
+ This tool is designed to measure the performance of Compressa models.
21
+ It uses the OpenAI API to run inference tasks and stores the results in a SQLite database.
22
+
23
+ ## Installation
24
+
25
+ ```bash
26
+ git clone https://github.com/compressa-ai/compressa-perf.git
27
+ cd compressa-perf
28
+ poetry install
29
+ ```
30
+
31
+ ## Install with Pip
32
+
33
+ ```bash
34
+ pip install compressa-perf
35
+ ```
36
+
37
+ ## Usage
38
+
39
+ ### 1. Run experiment with prompts from a file
40
+
41
+ ```bash
42
+ ❯ compressa-perf measure \
43
+ --openai_url https://some-api-url.ru/chat-2/v1/ \
44
+ --api_key "${OPENAI_API_KEY}" \
45
+ --model_name Compressa-Qwen2.5-14B-Instruct \
46
+ --experiment_name "File Prompts Run" \
47
+ --prompts_file resources/prompts.csv \
48
+ --num_tasks 1000 \
49
+ --num_runners 100
50
+ ```
51
+
52
+ ### 2. Run experiment with generated prompts
53
+
54
+ ```bash
55
+ ❯ compressa-perf measure \
56
+ --openai_url https://some-api-url.ru/chat-2/v1/ \
57
+ --api_key "${OPENAI_API_KEY}" \
58
+ --model_name Compressa-Qwen2.5-14B-Instruct \
59
+ --experiment_name "Generated Prompts Run" \
60
+ --num_tasks 2 \
61
+ --num_runners 2 \
62
+ --generate_prompts \
63
+ --num_prompts 1000 \
64
+ --prompt_length 5000
65
+ ```
66
+
67
+ Full parameter list can be obtained with `compressa-perf measure -h`.
68
+
69
+ ### 3. Run set of experiments from YAML file
70
+
71
+ You can describe set of experiments in YAML file and run them on different services in one command:
72
+
73
+ ```bash
74
+ ❯ compressa-perf measure-from-yaml experiments.yaml
75
+ ```
76
+
77
+ Example of YAML file:
78
+
79
+ ```yaml
80
+ - openai_url: https://some-api-url/v1/
81
+ model_name: Compressa-Qwen2-72B-Instruct
82
+ experiment_name: "File Prompts Run 1"
83
+ description: "Experiment using prompts from a file with 10 tasks and 5 runners"
84
+ prompts_file: resources/prompts.csv
85
+ num_tasks: 10
86
+ num_runners: 5
87
+ generate_prompts: false
88
+ num_prompts: 0
89
+ prompt_length: 0
90
+ max_tokens: 1000
91
+
92
+ - openai_url: https://some-api-url/v1/
93
+ model_name: Compressa-Qwen2-72B-Instruct
94
+ experiment_name: "Qwen2-72B Long Input / Short Output"
95
+ description: "Experiment using prompts from a file with 20 tasks and 10 runners"
96
+ prompts_file: resources/prompts.csv
97
+ num_tasks: 20
98
+ num_runners: 10
99
+ generate_prompts: true
100
+ num_prompts: 10
101
+ prompt_length: 10000
102
+ max_tokens: 100
103
+ ```
104
+
105
+ ### 4. List experiments
106
+
107
+ You can select experiments by name, parameters or metrics (or substrings in these fields) via `compressa-perf list` command.
108
+
109
+ For example:
110
+ ```
111
+ ❯ compressa-perf list \
112
+ --show-metrics \
113
+ --param-filter openai_url=chat-2 \
114
+ --param-filter avg_n_input=30
115
+
116
+ List of Experiments:
117
+ +----+----------------------------------------------------------------------------+---------------------+--------+-----------------------+
118
+ | | ID | Name | Date | Description |
119
+ +====+============================================================================+=====================+========+=======================+
120
+ | 25 | Compressa-Qwen2.5-14B-Instruct-Int4 Long Input / Short Output | 5 runners | 2024-10-03 06:21:45 | | ttft: 25.0960 |
121
+ | | | | | latency: 52.5916 |
122
+ | | | | | tpot: 0.5530 |
123
+ | | | | | throughput: 2891.0323 |
124
+ +----+----------------------------------------------------------------------------+---------------------+--------+-----------------------+
125
+ | 23 | Compressa-Qwen2.5-14B-Instruct-Int4 Long Input / Short Output | 4 runners | 2024-10-03 06:14:57 | | ttft: 17.1862 |
126
+ | | | | | latency: 37.9612 |
127
+ | | | | | tpot: 0.3954 |
128
+ | | | | | throughput: 3230.8769 |
129
+ +----+----------------------------------------------------------------------------+---------------------+--------+-----------------------+
130
+ ```
131
+
132
+ Full parameter list:
133
+ ```bash
134
+ ❯ compressa-perf list -h
135
+ usage: compressa-perf list [-h] [--db DB] [--show-parameters] [--show-metrics] [--name-filter NAME_FILTER] [--param-filter PARAM_FILTER]
136
+
137
+ options:
138
+ -h, --help show this help message and exit
139
+ --db DB Path to the SQLite database
140
+ --show-parameters Show all parameters for each experiment
141
+ --show-metrics Show metrics for each experiment
142
+ --name-filter NAME_FILTER
143
+ Filter experiments by substring in the name
144
+ --param-filter PARAM_FILTER
145
+ Filter experiments by parameter value (e.g., paramkey=value_substring)
146
+ ```
147
+
148
+
149
+ ### 5. Generate a report for an experiment
150
+
151
+ ```bash
152
+ ❯ compressa-perf report <EXPERIMENT_ID>
153
+ ```
154
+
155
+ Output example:
156
+
157
+ ```
158
+ ❯ compressa-perf report 3
159
+
160
+ Experiment Details:
161
+ ID: 3
162
+ Name: My First Run
163
+ Date: 2024-09-24 07:10:39
164
+ Description: None
165
+
166
+ Experiment Parameters:
167
+ ╒══════════════╤═══════════════════════════════════════════╕
168
+ │ Parameter │ Value │
169
+ ╞══════════════╪═══════════════════════════════════════════╡
170
+ │ num_workers │ 2 │
171
+ ├──────────────┼───────────────────────────────────────────┤
172
+ │ num_tasks │ 2 │
173
+ ├──────────────┼───────────────────────────────────────────┤
174
+ │ openai_url │ https://some-api-url.ru/chat-2/v1/ │
175
+ ├──────────────┼───────────────────────────────────────────┤
176
+ │ avg_n_input │ 32 │
177
+ ├──────────────┼───────────────────────────────────────────┤
178
+ │ std_n_input │ 2.8284 │
179
+ ├──────────────┼───────────────────────────────────────────┤
180
+ │ avg_n_output │ 748.5000 │
181
+ ├──────────────┼───────────────────────────────────────────┤
182
+ │ std_n_output │ 2.1213 │
183
+ ╘══════════════╧═══════════════════════════════════════════╛
184
+
185
+ Experiment Metrics:
186
+ ╒═══════════════════════╤══════════╕
187
+ │ Metric │ Value │
188
+ ╞═══════════════════════╪══════════╡
189
+ │ MetricName.TTFT │ 0.7753 │
190
+ ├───────────────────────┼──────────┤
191
+ │ MetricName.LATENCY │ 7.5016 │
192
+ ├───────────────────────┼──────────┤
193
+ │ MetricName.TPOT │ 0.01 │
194
+ ├───────────────────────┼──────────┤
195
+ │ MetricName.THROUGHPUT │ 207.84 │
196
+ ╘═══════════════════════╧══════════╛
197
+ ```
198
+
199
+ For more information on available commands and options, run:
200
+
201
+ ```bash
202
+ compressa-perf --help
203
+ ```
204
+
205
+ ## License
206
+
207
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
208
+
@@ -0,0 +1,190 @@
1
+ # Compressa Performance Measurement Tool
2
+
3
+ This tool is designed to measure the performance of Compressa models.
4
+ It uses the OpenAI API to run inference tasks and stores the results in a SQLite database.
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ git clone https://github.com/compressa-ai/compressa-perf.git
10
+ cd compressa-perf
11
+ poetry install
12
+ ```
13
+
14
+ ## Install with Pip
15
+
16
+ ```bash
17
+ pip install compressa-perf
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ### 1. Run experiment with prompts from a file
23
+
24
+ ```bash
25
+ ❯ compressa-perf measure \
26
+ --openai_url https://some-api-url.ru/chat-2/v1/ \
27
+ --api_key "${OPENAI_API_KEY}" \
28
+ --model_name Compressa-Qwen2.5-14B-Instruct \
29
+ --experiment_name "File Prompts Run" \
30
+ --prompts_file resources/prompts.csv \
31
+ --num_tasks 1000 \
32
+ --num_runners 100
33
+ ```
34
+
35
+ ### 2. Run experiment with generated prompts
36
+
37
+ ```bash
38
+ ❯ compressa-perf measure \
39
+ --openai_url https://some-api-url.ru/chat-2/v1/ \
40
+ --api_key "${OPENAI_API_KEY}" \
41
+ --model_name Compressa-Qwen2.5-14B-Instruct \
42
+ --experiment_name "Generated Prompts Run" \
43
+ --num_tasks 2 \
44
+ --num_runners 2 \
45
+ --generate_prompts \
46
+ --num_prompts 1000 \
47
+ --prompt_length 5000
48
+ ```
49
+
50
+ Full parameter list can be obtained with `compressa-perf measure -h`.
51
+
52
+ ### 3. Run set of experiments from YAML file
53
+
54
+ You can describe set of experiments in YAML file and run them on different services in one command:
55
+
56
+ ```bash
57
+ ❯ compressa-perf measure-from-yaml experiments.yaml
58
+ ```
59
+
60
+ Example of YAML file:
61
+
62
+ ```yaml
63
+ - openai_url: https://some-api-url/v1/
64
+ model_name: Compressa-Qwen2-72B-Instruct
65
+ experiment_name: "File Prompts Run 1"
66
+ description: "Experiment using prompts from a file with 10 tasks and 5 runners"
67
+ prompts_file: resources/prompts.csv
68
+ num_tasks: 10
69
+ num_runners: 5
70
+ generate_prompts: false
71
+ num_prompts: 0
72
+ prompt_length: 0
73
+ max_tokens: 1000
74
+
75
+ - openai_url: https://some-api-url/v1/
76
+ model_name: Compressa-Qwen2-72B-Instruct
77
+ experiment_name: "Qwen2-72B Long Input / Short Output"
78
+ description: "Experiment using prompts from a file with 20 tasks and 10 runners"
79
+ prompts_file: resources/prompts.csv
80
+ num_tasks: 20
81
+ num_runners: 10
82
+ generate_prompts: true
83
+ num_prompts: 10
84
+ prompt_length: 10000
85
+ max_tokens: 100
86
+ ```
87
+
88
+ ### 4. List experiments
89
+
90
+ You can select experiments by name, parameters or metrics (or substrings in these fields) via `compressa-perf list` command.
91
+
92
+ For example:
93
+ ```
94
+ ❯ compressa-perf list \
95
+ --show-metrics \
96
+ --param-filter openai_url=chat-2 \
97
+ --param-filter avg_n_input=30
98
+
99
+ List of Experiments:
100
+ +----+----------------------------------------------------------------------------+---------------------+--------+-----------------------+
101
+ | | ID | Name | Date | Description |
102
+ +====+============================================================================+=====================+========+=======================+
103
+ | 25 | Compressa-Qwen2.5-14B-Instruct-Int4 Long Input / Short Output | 5 runners | 2024-10-03 06:21:45 | | ttft: 25.0960 |
104
+ | | | | | latency: 52.5916 |
105
+ | | | | | tpot: 0.5530 |
106
+ | | | | | throughput: 2891.0323 |
107
+ +----+----------------------------------------------------------------------------+---------------------+--------+-----------------------+
108
+ | 23 | Compressa-Qwen2.5-14B-Instruct-Int4 Long Input / Short Output | 4 runners | 2024-10-03 06:14:57 | | ttft: 17.1862 |
109
+ | | | | | latency: 37.9612 |
110
+ | | | | | tpot: 0.3954 |
111
+ | | | | | throughput: 3230.8769 |
112
+ +----+----------------------------------------------------------------------------+---------------------+--------+-----------------------+
113
+ ```
114
+
115
+ Full parameter list:
116
+ ```bash
117
+ ❯ compressa-perf list -h
118
+ usage: compressa-perf list [-h] [--db DB] [--show-parameters] [--show-metrics] [--name-filter NAME_FILTER] [--param-filter PARAM_FILTER]
119
+
120
+ options:
121
+ -h, --help show this help message and exit
122
+ --db DB Path to the SQLite database
123
+ --show-parameters Show all parameters for each experiment
124
+ --show-metrics Show metrics for each experiment
125
+ --name-filter NAME_FILTER
126
+ Filter experiments by substring in the name
127
+ --param-filter PARAM_FILTER
128
+ Filter experiments by parameter value (e.g., paramkey=value_substring)
129
+ ```
130
+
131
+
132
+ ### 5. Generate a report for an experiment
133
+
134
+ ```bash
135
+ ❯ compressa-perf report <EXPERIMENT_ID>
136
+ ```
137
+
138
+ Output example:
139
+
140
+ ```
141
+ ❯ compressa-perf report 3
142
+
143
+ Experiment Details:
144
+ ID: 3
145
+ Name: My First Run
146
+ Date: 2024-09-24 07:10:39
147
+ Description: None
148
+
149
+ Experiment Parameters:
150
+ ╒══════════════╤═══════════════════════════════════════════╕
151
+ │ Parameter │ Value │
152
+ ╞══════════════╪═══════════════════════════════════════════╡
153
+ │ num_workers │ 2 │
154
+ ├──────────────┼───────────────────────────────────────────┤
155
+ │ num_tasks │ 2 │
156
+ ├──────────────┼───────────────────────────────────────────┤
157
+ │ openai_url │ https://some-api-url.ru/chat-2/v1/ │
158
+ ├──────────────┼───────────────────────────────────────────┤
159
+ │ avg_n_input │ 32 │
160
+ ├──────────────┼───────────────────────────────────────────┤
161
+ │ std_n_input │ 2.8284 │
162
+ ├──────────────┼───────────────────────────────────────────┤
163
+ │ avg_n_output │ 748.5000 │
164
+ ├──────────────┼───────────────────────────────────────────┤
165
+ │ std_n_output │ 2.1213 │
166
+ ╘══════════════╧═══════════════════════════════════════════╛
167
+
168
+ Experiment Metrics:
169
+ ╒═══════════════════════╤══════════╕
170
+ │ Metric │ Value │
171
+ ╞═══════════════════════╪══════════╡
172
+ │ MetricName.TTFT │ 0.7753 │
173
+ ├───────────────────────┼──────────┤
174
+ │ MetricName.LATENCY │ 7.5016 │
175
+ ├───────────────────────┼──────────┤
176
+ │ MetricName.TPOT │ 0.01 │
177
+ ├───────────────────────┼──────────┤
178
+ │ MetricName.THROUGHPUT │ 207.84 │
179
+ ╘═══════════════════════╧══════════╛
180
+ ```
181
+
182
+ For more information on available commands and options, run:
183
+
184
+ ```bash
185
+ compressa-perf --help
186
+ ```
187
+
188
+ ## License
189
+
190
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
@@ -0,0 +1,29 @@
1
+ [tool.poetry]
2
+ name = "compressa-perf"
3
+ version = "0.1.0"
4
+ description = "Performance Measurement tool by Compresss"
5
+ authors = ["Gleb Morgachev <morgachev.g@gmail.com>"]
6
+ readme = "README.md"
7
+ packages = [{include = "compressa", from = "src"}]
8
+
9
+ [tool.poetry.dependencies]
10
+ python = "^3.9"
11
+ python-dotenv = "^1.0.1"
12
+ openai = "^1.47.1"
13
+ tabulate = "^0.9.0"
14
+
15
+ [tool.poetry.group.dev.dependencies]
16
+ jupyterlab = "^4.2.4"
17
+ black = "^24.8.0"
18
+ datasets = "^3.0.1"
19
+ transformers = "^4.45.1"
20
+
21
+ [tool.pytest.ini_options]
22
+ pythonpath = ["src"]
23
+
24
+ [tool.poetry.scripts]
25
+ compressa-perf = "compressa.perf.cli.__main__:main"
26
+
27
+ [build-system]
28
+ requires = ["poetry-core"]
29
+ build-backend = "poetry.core.masonry.api"
File without changes
@@ -0,0 +1,228 @@
1
+ import argparse
2
+ from typing import List
3
+ from compressa.perf.cli.tools import (
4
+ run_experiment,
5
+ report_experiment,
6
+ list_experiments,
7
+ run_experiments_from_yaml,
8
+ DEFAULT_DB_PATH,
9
+ )
10
+
11
+
12
+ def run_experiment_args(args):
13
+ run_experiment(
14
+ db=args.db,
15
+ openai_api_key=args.openai_api_key,
16
+ openai_url=args.openai_url,
17
+ model_name=args.model_name,
18
+ experiment_name=args.experiment_name,
19
+ description=args.description,
20
+ prompts_file=args.prompts_file,
21
+ num_tasks=args.num_tasks,
22
+ num_runners=args.num_runners,
23
+ generate_prompts=args.generate_prompts,
24
+ num_prompts=args.num_prompts,
25
+ prompt_length=args.prompt_length,
26
+ max_tokens=args.max_tokens
27
+ )
28
+
29
+
30
+ def report_experiment_args(args):
31
+ report_experiment(
32
+ experiment_id=args.experiment_id,
33
+ db=args.db,
34
+ recompute=args.recompute
35
+ )
36
+
37
+
38
+ def list_experiments_args(args):
39
+ list_experiments(
40
+ db=args.db,
41
+ show_parameters=args.show_parameters,
42
+ show_metrics=args.show_metrics,
43
+ name_filter=args.name_filter,
44
+ param_filters=args.param_filter,
45
+ )
46
+
47
+
48
+ def run_experiments_from_yaml_args(args):
49
+ run_experiments_from_yaml(
50
+ yaml_file=args.yaml_file,
51
+ db=args.db,
52
+ openai_api_key=args.openai_api_key
53
+ )
54
+
55
+
56
+ def main():
57
+ parser = argparse.ArgumentParser(
58
+ description="CLI tool for running and analyzing experiments",
59
+ epilog="""
60
+ Examples:
61
+ 1. Run experiment with prompts from a file:
62
+ ```
63
+ compressa-perf measure \\
64
+ --openai_url https://api.qdrant.mil-team.ru/chat-2/v1/ \\
65
+ --api_key "${OPENAI_API_KEY}" \\
66
+ --model_name Compressa-Qwen2.5-14B-Instruct \\
67
+ --experiment_name "File Prompts Run" \\
68
+ --prompts_file resources/prompts.csv \\
69
+ --num_tasks 1000 \\
70
+ --num_runners 100
71
+ ```
72
+ 2. Run experiment with generated prompts:
73
+ ```
74
+ compressa-perf measure \\
75
+ --openai_url https://api.qdrant.mil-team.ru/chat-2/v1/ \\
76
+ --api_key "${OPENAI_API_KEY}" \\
77
+ --model_name Compressa-Qwen2.5-14B-Instruct \\
78
+ --experiment_name "Generated Prompts Run" \\
79
+ --num_tasks 2 \\
80
+ --num_runners 2 \\
81
+ --generate_prompts \\
82
+ --num_prompts 1000 \\
83
+ --prompt_length 5000
84
+ ```
85
+
86
+ 3. List all experiments:
87
+ ```
88
+ compressa-perf list
89
+ ```
90
+
91
+ 4. Generate a report for an experiment:
92
+ ```
93
+ compressa-perf report <EXPERIMENT_ID>
94
+ ```
95
+ """,
96
+ formatter_class=argparse.RawTextHelpFormatter
97
+ )
98
+ subparsers = parser.add_subparsers()
99
+
100
+ parser_run = subparsers.add_parser(
101
+ "measure",
102
+ help="Run an experiment",
103
+ )
104
+ parser_run.add_argument(
105
+ "--db",
106
+ type=str,
107
+ default=DEFAULT_DB_PATH,
108
+ help="Path to the SQLite database",
109
+ )
110
+ parser_run.add_argument(
111
+ "--openai_url", type=str, required=True, help="OpenAI-compatible API URL"
112
+ )
113
+ parser_run.add_argument(
114
+ "--model_name", type=str, required=True, help="Model name"
115
+ )
116
+ parser_run.add_argument(
117
+ "--experiment_name", type=str, required=True, help="Name of the experiment"
118
+ )
119
+ parser_run.add_argument(
120
+ "--description", type=str, help="Description of the experiment"
121
+ )
122
+ parser_run.add_argument(
123
+ "--prompts_file", type=str, help="Path to the file containing prompts (separated by newlines)"
124
+ )
125
+ parser_run.add_argument(
126
+ "--num_tasks", type=int, default=100, help="Number of requests to send"
127
+ )
128
+ parser_run.add_argument(
129
+ "--num_runners", type=int, default=10, help="Number of concurrent runners"
130
+ )
131
+ parser_run.add_argument(
132
+ "--api_key", type=str, required=True, help="API key"
133
+ )
134
+ parser_run.add_argument(
135
+ "--generate_prompts", action="store_true", help="Generate random prompts instead of using a file"
136
+ )
137
+ parser_run.add_argument(
138
+ "--num_prompts", type=int, default=100, help="Number of prompts to generate (if --generate_prompts is used)"
139
+ )
140
+ parser_run.add_argument(
141
+ "--prompt_length", type=int, default=100, help="Length of each generated prompt (if --generate_prompts is used)"
142
+ )
143
+ parser_run.add_argument(
144
+ "--max_tokens", type=int, default=1000, help="Maximum number of tokens for the model to generate"
145
+ )
146
+ parser_run.set_defaults(func=run_experiment_args)
147
+
148
+ parser_report = subparsers.add_parser(
149
+ "report",
150
+ help="Generate a report for an experiment",
151
+ )
152
+ parser_report.add_argument(
153
+ "experiment_id", type=int, help="ID of the experiment to report on"
154
+ )
155
+ parser_report.add_argument(
156
+ "--db",
157
+ type=str,
158
+ default=DEFAULT_DB_PATH,
159
+ help="Path to the SQLite database",
160
+ )
161
+ parser_report.add_argument(
162
+ "--recompute",
163
+ action="store_true",
164
+ help="Recompute metrics before generating the report",
165
+ )
166
+ parser_report.set_defaults(func=report_experiment_args)
167
+
168
+ parser_list = subparsers.add_parser(
169
+ "list",
170
+ help="List all experiments",
171
+ )
172
+ parser_list.add_argument(
173
+ "--db",
174
+ type=str,
175
+ default=DEFAULT_DB_PATH,
176
+ help="Path to the SQLite database",
177
+ )
178
+ parser_list.add_argument(
179
+ "--show-parameters",
180
+ action="store_true",
181
+ help="Show all parameters for each experiment"
182
+ )
183
+ parser_list.add_argument(
184
+ "--show-metrics",
185
+ action="store_true",
186
+ help="Show metrics for each experiment"
187
+ )
188
+ parser_list.add_argument(
189
+ "--name-filter",
190
+ type=str,
191
+ help="Filter experiments by substring in the name"
192
+ )
193
+ parser_list.add_argument(
194
+ "--param-filter",
195
+ type=str,
196
+ action="append",
197
+ help="Filter experiments by parameter value (e.g., paramkey=value_substring)"
198
+ )
199
+ parser_list.set_defaults(func=list_experiments_args)
200
+
201
+ parser_yaml = subparsers.add_parser(
202
+ "measure-from-yaml",
203
+ help="Run experiments from a YAML configuration file",
204
+ )
205
+ parser_yaml.add_argument(
206
+ "yaml_file",
207
+ help="YAML configuration file for experiments",
208
+ )
209
+ parser_yaml.add_argument(
210
+ "--db",
211
+ type=str,
212
+ default=DEFAULT_DB_PATH,
213
+ help="Path to the SQLite database",
214
+ )
215
+ parser_yaml.add_argument(
216
+ "--api_key",
217
+ type=str,
218
+ required=True,
219
+ help="OpenAI API key",
220
+ )
221
+ parser_yaml.set_defaults(func=run_experiments_from_yaml_args)
222
+
223
+ args = parser.parse_args()
224
+ args.func(args)
225
+
226
+
227
+ if __name__ == "__main__":
228
+ main()