weco 0.2.4__tar.gz → 0.2.5__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.
@@ -90,7 +90,7 @@ jobs:
90
90
  GITHUB_TOKEN: ${{ github.token }}
91
91
  run: >-
92
92
  gh release create
93
- 'v0.2.4'
93
+ 'v0.2.5'
94
94
  --repo '${{ github.repository }}'
95
95
  --notes ""
96
96
 
@@ -102,5 +102,5 @@ jobs:
102
102
  # sigstore-produced signatures and certificates.
103
103
  run: >-
104
104
  gh release upload
105
- 'v0.2.4' dist/**
105
+ 'v0.2.5' dist/**
106
106
  --repo '${{ github.repository }}'
weco-0.2.5/PKG-INFO ADDED
@@ -0,0 +1,189 @@
1
+ Metadata-Version: 2.4
2
+ Name: weco
3
+ Version: 0.2.5
4
+ Summary: Documentation for `weco`, a CLI for using Weco AI's code optimizer.
5
+ Author-email: Weco AI Team <dhruv@weco.ai>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/WecoAI/weco-cli
8
+ Keywords: AI,Code Optimization,Code Generation
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Requires-Python: >=3.12
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: requests
16
+ Requires-Dist: rich
17
+ Provides-Extra: dev
18
+ Requires-Dist: ruff; extra == "dev"
19
+ Requires-Dist: build; extra == "dev"
20
+ Requires-Dist: setuptools_scm; extra == "dev"
21
+ Dynamic: license-file
22
+
23
+ # Weco CLI – Code Optimizer for Machine Learning Engineers
24
+
25
+ [![Python](https://img.shields.io/badge/Python-3.12.0-blue)](https://www.python.org)
26
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
27
+ [![PyPI version](https://badge.fury.io/py/weco.svg)](https://badge.fury.io/py/weco)
28
+
29
+ `weco` is a command-line interface for interacting with Weco AI's code optimizer, powered by [AI-Driven Exploration](https://arxiv.org/abs/2502.13138). It helps you automate the improvement of your code for tasks like GPU kernel optimization, feature engineering, model development, and prompt engineering.
30
+
31
+ https://github.com/user-attachments/assets/cb724ef1-bff6-4757-b457-d3b2201ede81
32
+
33
+ ---
34
+
35
+ ## Overview
36
+
37
+ The `weco` CLI leverages a tree search approach guided by Large Language Models (LLMs) to iteratively explore and refine your code. It automatically applies changes, runs your evaluation script, parses the results, and proposes further improvements based on the specified goal.
38
+
39
+ ![image](https://github.com/user-attachments/assets/a6ed63fa-9c40-498e-aa98-a873e5786509)
40
+
41
+ ---
42
+
43
+ ## Example Use Cases
44
+
45
+ Here's how `weco` can be applied to common ML engineering tasks:
46
+
47
+ * **GPU Kernel Optimization:**
48
+ * **Goal:** Improve the speed or efficiency of low-level GPU code.
49
+ * **How:** `weco` iteratively refines CUDA, Triton, Metal, or other kernel code specified in your `--source` file.
50
+ * **`--eval-command`:** Typically runs a script that compiles the kernel, executes it, and benchmarks performance (e.g., latency, throughput).
51
+ * **`--metric`:** Examples include `latency`, `throughput`, `TFLOPS`, `memory_bandwidth`. Optimize to `minimize` latency or `maximize` throughput.
52
+
53
+ * **Feature Engineering:**
54
+ * **Goal:** Discover better data transformations or feature combinations for your machine learning models.
55
+ * **How:** `weco` explores different processing steps or parameters within your feature transformation code (`--source`).
56
+ * **`--eval-command`:** Executes a script that applies the features, trains/validates a model using those features, and prints a performance score.
57
+ * **`--metric`:** Examples include `accuracy`, `AUC`, `F1-score`, `validation_loss`. Usually optimized to `maximize` accuracy/AUC/F1 or `minimize` loss.
58
+
59
+ * **Model Development:**
60
+ * **Goal:** Tune hyperparameters or experiment with small architectural changes directly within your model's code.
61
+ * **How:** `weco` modifies hyperparameter values (like learning rate, layer sizes if defined in the code) or structural elements in your model definition (`--source`).
62
+ * **`--eval-command`:** Runs your model training and evaluation script, printing the key performance indicator.
63
+ * **`--metric`:** Examples include `validation_accuracy`, `test_loss`, `inference_time`, `perplexity`. Optimize according to the metric's nature (e.g., `maximize` accuracy, `minimize` loss).
64
+
65
+ * **Prompt Engineering:**
66
+ * **Goal:** Refine prompts used within larger systems (e.g., for LLM interactions) to achieve better or more consistent outputs.
67
+ * **How:** `weco` modifies prompt templates, examples, or instructions stored in the `--source` file.
68
+ * **`--eval-command`:** Executes a script that uses the prompt, generates an output, evaluates that output against desired criteria (e.g., using another LLM, checking for keywords, format validation), and prints a score.
69
+ * **`--metric`:** Examples include `quality_score`, `relevance`, `task_success_rate`, `format_adherence`. Usually optimized to `maximize`.
70
+
71
+ ---
72
+
73
+
74
+ ## Setup
75
+
76
+ 1. **Install the Package:**
77
+
78
+ ```bash
79
+ pip install weco
80
+ ```
81
+
82
+ 2. **Configure API Keys:**
83
+
84
+ Set the appropriate environment variables for your desired language model provider:
85
+
86
+ - **OpenAI:** `export OPENAI_API_KEY="your_key_here"`
87
+ - **Anthropic:** `export ANTHROPIC_API_KEY="your_key_here"`
88
+ - **Google DeepMind:** `export GEMINI_API_KEY="your_key_here"` (Google AI Studio has a free API usage quota. Create a key [here](https://aistudio.google.com/apikey) to use weco for free.)
89
+
90
+ ---
91
+
92
+ ## Usage
93
+ <div style="background-color: #fff3cd; border: 1px solid #ffeeba; padding: 15px; border-radius: 4px; margin-bottom: 15px;">
94
+ <strong>⚠️ Warning: Code Modification</strong><br>
95
+ <code>weco</code> directly modifies the file specified by <code>--source</code> during the optimization process. It is <strong>strongly recommended</strong> to use version control (like Git) to track changes and revert if needed. Alternatively, ensure you have a backup of your original file before running the command. Upon completion, the file will contain the best-performing version of the code found during the run.
96
+ </div>
97
+
98
+ ---
99
+
100
+ ### Examples
101
+
102
+ **Example 1: Optimizing PyTorch operations**
103
+
104
+ ```bash
105
+ weco --source examples/simple-torch/optimize.py \
106
+ --eval-command "python examples/simple-torch/evaluate.py --solution-path examples/simple-torch/optimize.py --device mps" \
107
+ --metric speedup \
108
+ --maximize true \
109
+ --steps 15 \
110
+ --model o3-mini \
111
+ --additional-instructions "Fuse operations in the forward method while ensuring the max float deviation remains small. Maintain the same format of the code."
112
+ ```
113
+
114
+ **Example 2: Optimizing MLX operations with instructions from a file**
115
+
116
+ Sometimes, additional context or instructions are too complex for a single command-line string. You can provide a path to a file containing these instructions.
117
+
118
+ ```bash
119
+ weco --source examples/simple-mlx/optimize.py \
120
+ --eval-command "python examples/simple-mlx/evaluate.py --solution-path examples/simple-mlx/optimize.py" \
121
+ --metric speedup \
122
+ --maximize true \
123
+ --steps 30 \
124
+ --model o3-mini \
125
+ --additional-instructions examples/simple-mlx/metal-examples.rst
126
+ ```
127
+
128
+ ---
129
+
130
+ ### Command Line Arguments
131
+
132
+ | Argument | Description | Required |
133
+ | :-------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- |
134
+ | `--source` | Path to the source code file that will be optimized (e.g., `optimize.py`). | Yes |
135
+ | `--eval-command` | Command to run for evaluating the code in `--source`. This command should print the target `--metric` and its value to the terminal (stdout/stderr). See note below. | Yes |
136
+ | `--metric` | The name of the metric you want to optimize (e.g., 'accuracy', 'speedup', 'loss'). This metric name should match what's printed by your `--eval-command`. | Yes |
137
+ | `--maximize` | Whether to maximize (`true`) or minimize (`false`) the metric. | Yes |
138
+ | `--steps` | Number of optimization steps (LLM iterations) to run. | Yes |
139
+ | `--model` | Model identifier for the LLM to use (e.g., `gpt-4o`, `claude-3.5-sonnet`). Recommended models to try include `o3-mini`, `claude-3-haiku`, and `gemini-2.5-pro-exp-03-25`. | Yes |
140
+ | `--additional-instructions` | (Optional) Natural language description of specific instructions OR path to a file containing detailed instructions to guide the LLM. | No |
141
+
142
+ ---
143
+
144
+
145
+
146
+ ### Important Note on Evaluation
147
+
148
+ The command specified by `--eval-command` is crucial. It's responsible for executing the potentially modified code from `--source` and assessing its performance. **This command MUST print the metric you specified with `--metric` along with its numerical value to the terminal (standard output or standard error).** Weco reads this output to understand how well each code version performs and guide the optimization process.
149
+
150
+ For example, if you set `--metric speedup`, your evaluation script (`eval.py` in the examples) should output a line like:
151
+
152
+ ```
153
+ speedup: 1.5
154
+ ```
155
+
156
+ or
157
+
158
+ ```
159
+ Final speedup value = 1.5
160
+ ```
161
+
162
+ Weco will parse this output to extract the numerical value (1.5 in this case) associated with the metric name ('speedup').
163
+
164
+
165
+ ## Contributing
166
+
167
+ We welcome contributions! To get started:
168
+
169
+ 1. **Fork and Clone the Repository:**
170
+ ```bash
171
+ git clone https://github.com/WecoAI/weco-cli.git
172
+ cd weco-cli
173
+ ```
174
+
175
+ 2. **Install Development Dependencies:**
176
+ ```bash
177
+ pip install -e ".[dev]"
178
+ ```
179
+
180
+ 3. **Create a Feature Branch:**
181
+ ```bash
182
+ git checkout -b feature/your-feature-name
183
+ ```
184
+
185
+ 4. **Make Your Changes:** Ensure your code adheres to our style guidelines and includes relevant tests.
186
+
187
+ 5. **Commit and Push** your changes, then open a pull request with a clear description of your enhancements.
188
+
189
+ ---
weco-0.2.5/README.md ADDED
@@ -0,0 +1,167 @@
1
+ # Weco CLI – Code Optimizer for Machine Learning Engineers
2
+
3
+ [![Python](https://img.shields.io/badge/Python-3.12.0-blue)](https://www.python.org)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
5
+ [![PyPI version](https://badge.fury.io/py/weco.svg)](https://badge.fury.io/py/weco)
6
+
7
+ `weco` is a command-line interface for interacting with Weco AI's code optimizer, powered by [AI-Driven Exploration](https://arxiv.org/abs/2502.13138). It helps you automate the improvement of your code for tasks like GPU kernel optimization, feature engineering, model development, and prompt engineering.
8
+
9
+ https://github.com/user-attachments/assets/cb724ef1-bff6-4757-b457-d3b2201ede81
10
+
11
+ ---
12
+
13
+ ## Overview
14
+
15
+ The `weco` CLI leverages a tree search approach guided by Large Language Models (LLMs) to iteratively explore and refine your code. It automatically applies changes, runs your evaluation script, parses the results, and proposes further improvements based on the specified goal.
16
+
17
+ ![image](https://github.com/user-attachments/assets/a6ed63fa-9c40-498e-aa98-a873e5786509)
18
+
19
+ ---
20
+
21
+ ## Example Use Cases
22
+
23
+ Here's how `weco` can be applied to common ML engineering tasks:
24
+
25
+ * **GPU Kernel Optimization:**
26
+ * **Goal:** Improve the speed or efficiency of low-level GPU code.
27
+ * **How:** `weco` iteratively refines CUDA, Triton, Metal, or other kernel code specified in your `--source` file.
28
+ * **`--eval-command`:** Typically runs a script that compiles the kernel, executes it, and benchmarks performance (e.g., latency, throughput).
29
+ * **`--metric`:** Examples include `latency`, `throughput`, `TFLOPS`, `memory_bandwidth`. Optimize to `minimize` latency or `maximize` throughput.
30
+
31
+ * **Feature Engineering:**
32
+ * **Goal:** Discover better data transformations or feature combinations for your machine learning models.
33
+ * **How:** `weco` explores different processing steps or parameters within your feature transformation code (`--source`).
34
+ * **`--eval-command`:** Executes a script that applies the features, trains/validates a model using those features, and prints a performance score.
35
+ * **`--metric`:** Examples include `accuracy`, `AUC`, `F1-score`, `validation_loss`. Usually optimized to `maximize` accuracy/AUC/F1 or `minimize` loss.
36
+
37
+ * **Model Development:**
38
+ * **Goal:** Tune hyperparameters or experiment with small architectural changes directly within your model's code.
39
+ * **How:** `weco` modifies hyperparameter values (like learning rate, layer sizes if defined in the code) or structural elements in your model definition (`--source`).
40
+ * **`--eval-command`:** Runs your model training and evaluation script, printing the key performance indicator.
41
+ * **`--metric`:** Examples include `validation_accuracy`, `test_loss`, `inference_time`, `perplexity`. Optimize according to the metric's nature (e.g., `maximize` accuracy, `minimize` loss).
42
+
43
+ * **Prompt Engineering:**
44
+ * **Goal:** Refine prompts used within larger systems (e.g., for LLM interactions) to achieve better or more consistent outputs.
45
+ * **How:** `weco` modifies prompt templates, examples, or instructions stored in the `--source` file.
46
+ * **`--eval-command`:** Executes a script that uses the prompt, generates an output, evaluates that output against desired criteria (e.g., using another LLM, checking for keywords, format validation), and prints a score.
47
+ * **`--metric`:** Examples include `quality_score`, `relevance`, `task_success_rate`, `format_adherence`. Usually optimized to `maximize`.
48
+
49
+ ---
50
+
51
+
52
+ ## Setup
53
+
54
+ 1. **Install the Package:**
55
+
56
+ ```bash
57
+ pip install weco
58
+ ```
59
+
60
+ 2. **Configure API Keys:**
61
+
62
+ Set the appropriate environment variables for your desired language model provider:
63
+
64
+ - **OpenAI:** `export OPENAI_API_KEY="your_key_here"`
65
+ - **Anthropic:** `export ANTHROPIC_API_KEY="your_key_here"`
66
+ - **Google DeepMind:** `export GEMINI_API_KEY="your_key_here"` (Google AI Studio has a free API usage quota. Create a key [here](https://aistudio.google.com/apikey) to use weco for free.)
67
+
68
+ ---
69
+
70
+ ## Usage
71
+ <div style="background-color: #fff3cd; border: 1px solid #ffeeba; padding: 15px; border-radius: 4px; margin-bottom: 15px;">
72
+ <strong>⚠️ Warning: Code Modification</strong><br>
73
+ <code>weco</code> directly modifies the file specified by <code>--source</code> during the optimization process. It is <strong>strongly recommended</strong> to use version control (like Git) to track changes and revert if needed. Alternatively, ensure you have a backup of your original file before running the command. Upon completion, the file will contain the best-performing version of the code found during the run.
74
+ </div>
75
+
76
+ ---
77
+
78
+ ### Examples
79
+
80
+ **Example 1: Optimizing PyTorch operations**
81
+
82
+ ```bash
83
+ weco --source examples/simple-torch/optimize.py \
84
+ --eval-command "python examples/simple-torch/evaluate.py --solution-path examples/simple-torch/optimize.py --device mps" \
85
+ --metric speedup \
86
+ --maximize true \
87
+ --steps 15 \
88
+ --model o3-mini \
89
+ --additional-instructions "Fuse operations in the forward method while ensuring the max float deviation remains small. Maintain the same format of the code."
90
+ ```
91
+
92
+ **Example 2: Optimizing MLX operations with instructions from a file**
93
+
94
+ Sometimes, additional context or instructions are too complex for a single command-line string. You can provide a path to a file containing these instructions.
95
+
96
+ ```bash
97
+ weco --source examples/simple-mlx/optimize.py \
98
+ --eval-command "python examples/simple-mlx/evaluate.py --solution-path examples/simple-mlx/optimize.py" \
99
+ --metric speedup \
100
+ --maximize true \
101
+ --steps 30 \
102
+ --model o3-mini \
103
+ --additional-instructions examples/simple-mlx/metal-examples.rst
104
+ ```
105
+
106
+ ---
107
+
108
+ ### Command Line Arguments
109
+
110
+ | Argument | Description | Required |
111
+ | :-------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- |
112
+ | `--source` | Path to the source code file that will be optimized (e.g., `optimize.py`). | Yes |
113
+ | `--eval-command` | Command to run for evaluating the code in `--source`. This command should print the target `--metric` and its value to the terminal (stdout/stderr). See note below. | Yes |
114
+ | `--metric` | The name of the metric you want to optimize (e.g., 'accuracy', 'speedup', 'loss'). This metric name should match what's printed by your `--eval-command`. | Yes |
115
+ | `--maximize` | Whether to maximize (`true`) or minimize (`false`) the metric. | Yes |
116
+ | `--steps` | Number of optimization steps (LLM iterations) to run. | Yes |
117
+ | `--model` | Model identifier for the LLM to use (e.g., `gpt-4o`, `claude-3.5-sonnet`). Recommended models to try include `o3-mini`, `claude-3-haiku`, and `gemini-2.5-pro-exp-03-25`. | Yes |
118
+ | `--additional-instructions` | (Optional) Natural language description of specific instructions OR path to a file containing detailed instructions to guide the LLM. | No |
119
+
120
+ ---
121
+
122
+
123
+
124
+ ### Important Note on Evaluation
125
+
126
+ The command specified by `--eval-command` is crucial. It's responsible for executing the potentially modified code from `--source` and assessing its performance. **This command MUST print the metric you specified with `--metric` along with its numerical value to the terminal (standard output or standard error).** Weco reads this output to understand how well each code version performs and guide the optimization process.
127
+
128
+ For example, if you set `--metric speedup`, your evaluation script (`eval.py` in the examples) should output a line like:
129
+
130
+ ```
131
+ speedup: 1.5
132
+ ```
133
+
134
+ or
135
+
136
+ ```
137
+ Final speedup value = 1.5
138
+ ```
139
+
140
+ Weco will parse this output to extract the numerical value (1.5 in this case) associated with the metric name ('speedup').
141
+
142
+
143
+ ## Contributing
144
+
145
+ We welcome contributions! To get started:
146
+
147
+ 1. **Fork and Clone the Repository:**
148
+ ```bash
149
+ git clone https://github.com/WecoAI/weco-cli.git
150
+ cd weco-cli
151
+ ```
152
+
153
+ 2. **Install Development Dependencies:**
154
+ ```bash
155
+ pip install -e ".[dev]"
156
+ ```
157
+
158
+ 3. **Create a Feature Branch:**
159
+ ```bash
160
+ git checkout -b feature/your-feature-name
161
+ ```
162
+
163
+ 4. **Make Your Changes:** Ensure your code adheres to our style guidelines and includes relevant tests.
164
+
165
+ 5. **Commit and Push** your changes, then open a pull request with a clear description of your enhancements.
166
+
167
+ ---
@@ -10,7 +10,7 @@ authors = [
10
10
  ]
11
11
  description = "Documentation for `weco`, a CLI for using Weco AI's code optimizer."
12
12
  readme = "README.md"
13
- version = "0.2.4"
13
+ version = "0.2.5"
14
14
  license = {text = "MIT"}
15
15
  requires-python = ">=3.12"
16
16
  dependencies = ["requests", "rich"]
@@ -1,4 +1,4 @@
1
1
  # DO NOT EDIT
2
- __pkg_version__ = "0.2.4"
2
+ __pkg_version__ = "0.2.5"
3
3
  __api_version__ = "v1"
4
4
  __base_url__ = f"https://api.aide.weco.ai/{__api_version__}"
@@ -29,6 +29,7 @@ def start_optimization_session(
29
29
  search_policy_config: Dict[str, Any],
30
30
  additional_instructions: str = None,
31
31
  api_keys: Dict[str, Any] = {},
32
+ timeout: int = 800,
32
33
  ) -> Dict[str, Any]:
33
34
  """Start the optimization session."""
34
35
  with console.status("[bold green]Starting Optimization..."):
@@ -47,6 +48,7 @@ def start_optimization_session(
47
48
  },
48
49
  "metadata": {"client_name": "cli", "client_version": __pkg_version__, **api_keys},
49
50
  },
51
+ timeout=timeout,
50
52
  )
51
53
  response.raise_for_status()
52
54
  return response.json()
@@ -60,6 +62,7 @@ def evaluate_feedback_then_suggest_next_solution(
60
62
  execution_output: str,
61
63
  additional_instructions: str = None,
62
64
  api_keys: Dict[str, Any] = {},
65
+ timeout: int = 800,
63
66
  ) -> Dict[str, Any]:
64
67
  """Evaluate the feedback and suggest the next solution."""
65
68
  try:
@@ -70,6 +73,7 @@ def evaluate_feedback_then_suggest_next_solution(
70
73
  "additional_instructions": additional_instructions,
71
74
  "metadata": {**api_keys},
72
75
  },
76
+ timeout=timeout,
73
77
  )
74
78
  response.raise_for_status()
75
79
  return response.json()
@@ -78,11 +82,13 @@ def evaluate_feedback_then_suggest_next_solution(
78
82
 
79
83
 
80
84
  def get_optimization_session_status(
81
- console: rich.console.Console, session_id: str, include_history: bool = False
85
+ console: rich.console.Console, session_id: str, include_history: bool = False, timeout: int = 800
82
86
  ) -> Dict[str, Any]:
83
87
  """Get the current status of the optimization session."""
84
88
  try:
85
- response = requests.get(f"{__base_url__}/sessions/{session_id}", params={"include_history": include_history})
89
+ response = requests.get(
90
+ f"{__base_url__}/sessions/{session_id}", params={"include_history": include_history}, timeout=timeout
91
+ )
86
92
  response.raise_for_status()
87
93
  return response.json()
88
94
  except requests.exceptions.HTTPError as e:
@@ -79,6 +79,8 @@ def main() -> None:
79
79
  source_code = read_from_path(fp=source_fp, is_json=False)
80
80
  # Read API keys
81
81
  api_keys = read_api_keys_from_env()
82
+ # API request timeout
83
+ timeout = 800
82
84
 
83
85
  # Initialize panels
84
86
  summary_panel = SummaryPanel(maximize=maximize, metric_name=metric_name, total_steps=steps, model=args.model)
@@ -102,6 +104,7 @@ def main() -> None:
102
104
  search_policy_config=search_policy_config,
103
105
  additional_instructions=additional_instructions,
104
106
  api_keys=api_keys,
107
+ timeout=timeout,
105
108
  )
106
109
 
107
110
  # Define the refresh rate
@@ -192,6 +195,7 @@ def main() -> None:
192
195
  execution_output=term_out,
193
196
  additional_instructions=additional_instructions,
194
197
  api_keys=api_keys,
198
+ timeout=timeout,
195
199
  )
196
200
  # Save next solution (.runs/<session-id>/step_<step>.py)
197
201
  write_to_path(fp=runs_dir / f"step_{step}.py", content=eval_and_next_solution_response["code"])
@@ -201,7 +205,9 @@ def main() -> None:
201
205
 
202
206
  # Get the optimization session status for
203
207
  # the best solution, its score, and the history to plot the tree
204
- status_response = get_optimization_session_status(console=console, session_id=session_id, include_history=True)
208
+ status_response = get_optimization_session_status(
209
+ console=console, session_id=session_id, include_history=True, timeout=timeout
210
+ )
205
211
 
206
212
  # Update the step of the progress bar
207
213
  summary_panel.set_step(step=step)
@@ -281,6 +287,7 @@ def main() -> None:
281
287
  execution_output=term_out,
282
288
  additional_instructions=additional_instructions,
283
289
  api_keys=api_keys,
290
+ timeout=timeout,
284
291
  )
285
292
 
286
293
  # Update the progress bar
@@ -290,7 +297,9 @@ def main() -> None:
290
297
  # No need to update the plan panel since we have finished the optimization
291
298
  # Get the optimization session status for
292
299
  # the best solution, its score, and the history to plot the tree
293
- status_response = get_optimization_session_status(console=console, session_id=session_id, include_history=True)
300
+ status_response = get_optimization_session_status(
301
+ console=console, session_id=session_id, include_history=True, timeout=timeout
302
+ )
294
303
  # Build the metric tree
295
304
  tree_panel.build_metric_tree(nodes=status_response["history"])
296
305
  # No need to set any solution to unevaluated since we have finished the optimization
@@ -0,0 +1,189 @@
1
+ Metadata-Version: 2.4
2
+ Name: weco
3
+ Version: 0.2.5
4
+ Summary: Documentation for `weco`, a CLI for using Weco AI's code optimizer.
5
+ Author-email: Weco AI Team <dhruv@weco.ai>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/WecoAI/weco-cli
8
+ Keywords: AI,Code Optimization,Code Generation
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Requires-Python: >=3.12
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: requests
16
+ Requires-Dist: rich
17
+ Provides-Extra: dev
18
+ Requires-Dist: ruff; extra == "dev"
19
+ Requires-Dist: build; extra == "dev"
20
+ Requires-Dist: setuptools_scm; extra == "dev"
21
+ Dynamic: license-file
22
+
23
+ # Weco CLI – Code Optimizer for Machine Learning Engineers
24
+
25
+ [![Python](https://img.shields.io/badge/Python-3.12.0-blue)](https://www.python.org)
26
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
27
+ [![PyPI version](https://badge.fury.io/py/weco.svg)](https://badge.fury.io/py/weco)
28
+
29
+ `weco` is a command-line interface for interacting with Weco AI's code optimizer, powered by [AI-Driven Exploration](https://arxiv.org/abs/2502.13138). It helps you automate the improvement of your code for tasks like GPU kernel optimization, feature engineering, model development, and prompt engineering.
30
+
31
+ https://github.com/user-attachments/assets/cb724ef1-bff6-4757-b457-d3b2201ede81
32
+
33
+ ---
34
+
35
+ ## Overview
36
+
37
+ The `weco` CLI leverages a tree search approach guided by Large Language Models (LLMs) to iteratively explore and refine your code. It automatically applies changes, runs your evaluation script, parses the results, and proposes further improvements based on the specified goal.
38
+
39
+ ![image](https://github.com/user-attachments/assets/a6ed63fa-9c40-498e-aa98-a873e5786509)
40
+
41
+ ---
42
+
43
+ ## Example Use Cases
44
+
45
+ Here's how `weco` can be applied to common ML engineering tasks:
46
+
47
+ * **GPU Kernel Optimization:**
48
+ * **Goal:** Improve the speed or efficiency of low-level GPU code.
49
+ * **How:** `weco` iteratively refines CUDA, Triton, Metal, or other kernel code specified in your `--source` file.
50
+ * **`--eval-command`:** Typically runs a script that compiles the kernel, executes it, and benchmarks performance (e.g., latency, throughput).
51
+ * **`--metric`:** Examples include `latency`, `throughput`, `TFLOPS`, `memory_bandwidth`. Optimize to `minimize` latency or `maximize` throughput.
52
+
53
+ * **Feature Engineering:**
54
+ * **Goal:** Discover better data transformations or feature combinations for your machine learning models.
55
+ * **How:** `weco` explores different processing steps or parameters within your feature transformation code (`--source`).
56
+ * **`--eval-command`:** Executes a script that applies the features, trains/validates a model using those features, and prints a performance score.
57
+ * **`--metric`:** Examples include `accuracy`, `AUC`, `F1-score`, `validation_loss`. Usually optimized to `maximize` accuracy/AUC/F1 or `minimize` loss.
58
+
59
+ * **Model Development:**
60
+ * **Goal:** Tune hyperparameters or experiment with small architectural changes directly within your model's code.
61
+ * **How:** `weco` modifies hyperparameter values (like learning rate, layer sizes if defined in the code) or structural elements in your model definition (`--source`).
62
+ * **`--eval-command`:** Runs your model training and evaluation script, printing the key performance indicator.
63
+ * **`--metric`:** Examples include `validation_accuracy`, `test_loss`, `inference_time`, `perplexity`. Optimize according to the metric's nature (e.g., `maximize` accuracy, `minimize` loss).
64
+
65
+ * **Prompt Engineering:**
66
+ * **Goal:** Refine prompts used within larger systems (e.g., for LLM interactions) to achieve better or more consistent outputs.
67
+ * **How:** `weco` modifies prompt templates, examples, or instructions stored in the `--source` file.
68
+ * **`--eval-command`:** Executes a script that uses the prompt, generates an output, evaluates that output against desired criteria (e.g., using another LLM, checking for keywords, format validation), and prints a score.
69
+ * **`--metric`:** Examples include `quality_score`, `relevance`, `task_success_rate`, `format_adherence`. Usually optimized to `maximize`.
70
+
71
+ ---
72
+
73
+
74
+ ## Setup
75
+
76
+ 1. **Install the Package:**
77
+
78
+ ```bash
79
+ pip install weco
80
+ ```
81
+
82
+ 2. **Configure API Keys:**
83
+
84
+ Set the appropriate environment variables for your desired language model provider:
85
+
86
+ - **OpenAI:** `export OPENAI_API_KEY="your_key_here"`
87
+ - **Anthropic:** `export ANTHROPIC_API_KEY="your_key_here"`
88
+ - **Google DeepMind:** `export GEMINI_API_KEY="your_key_here"` (Google AI Studio has a free API usage quota. Create a key [here](https://aistudio.google.com/apikey) to use weco for free.)
89
+
90
+ ---
91
+
92
+ ## Usage
93
+ <div style="background-color: #fff3cd; border: 1px solid #ffeeba; padding: 15px; border-radius: 4px; margin-bottom: 15px;">
94
+ <strong>⚠️ Warning: Code Modification</strong><br>
95
+ <code>weco</code> directly modifies the file specified by <code>--source</code> during the optimization process. It is <strong>strongly recommended</strong> to use version control (like Git) to track changes and revert if needed. Alternatively, ensure you have a backup of your original file before running the command. Upon completion, the file will contain the best-performing version of the code found during the run.
96
+ </div>
97
+
98
+ ---
99
+
100
+ ### Examples
101
+
102
+ **Example 1: Optimizing PyTorch operations**
103
+
104
+ ```bash
105
+ weco --source examples/simple-torch/optimize.py \
106
+ --eval-command "python examples/simple-torch/evaluate.py --solution-path examples/simple-torch/optimize.py --device mps" \
107
+ --metric speedup \
108
+ --maximize true \
109
+ --steps 15 \
110
+ --model o3-mini \
111
+ --additional-instructions "Fuse operations in the forward method while ensuring the max float deviation remains small. Maintain the same format of the code."
112
+ ```
113
+
114
+ **Example 2: Optimizing MLX operations with instructions from a file**
115
+
116
+ Sometimes, additional context or instructions are too complex for a single command-line string. You can provide a path to a file containing these instructions.
117
+
118
+ ```bash
119
+ weco --source examples/simple-mlx/optimize.py \
120
+ --eval-command "python examples/simple-mlx/evaluate.py --solution-path examples/simple-mlx/optimize.py" \
121
+ --metric speedup \
122
+ --maximize true \
123
+ --steps 30 \
124
+ --model o3-mini \
125
+ --additional-instructions examples/simple-mlx/metal-examples.rst
126
+ ```
127
+
128
+ ---
129
+
130
+ ### Command Line Arguments
131
+
132
+ | Argument | Description | Required |
133
+ | :-------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- |
134
+ | `--source` | Path to the source code file that will be optimized (e.g., `optimize.py`). | Yes |
135
+ | `--eval-command` | Command to run for evaluating the code in `--source`. This command should print the target `--metric` and its value to the terminal (stdout/stderr). See note below. | Yes |
136
+ | `--metric` | The name of the metric you want to optimize (e.g., 'accuracy', 'speedup', 'loss'). This metric name should match what's printed by your `--eval-command`. | Yes |
137
+ | `--maximize` | Whether to maximize (`true`) or minimize (`false`) the metric. | Yes |
138
+ | `--steps` | Number of optimization steps (LLM iterations) to run. | Yes |
139
+ | `--model` | Model identifier for the LLM to use (e.g., `gpt-4o`, `claude-3.5-sonnet`). Recommended models to try include `o3-mini`, `claude-3-haiku`, and `gemini-2.5-pro-exp-03-25`. | Yes |
140
+ | `--additional-instructions` | (Optional) Natural language description of specific instructions OR path to a file containing detailed instructions to guide the LLM. | No |
141
+
142
+ ---
143
+
144
+
145
+
146
+ ### Important Note on Evaluation
147
+
148
+ The command specified by `--eval-command` is crucial. It's responsible for executing the potentially modified code from `--source` and assessing its performance. **This command MUST print the metric you specified with `--metric` along with its numerical value to the terminal (standard output or standard error).** Weco reads this output to understand how well each code version performs and guide the optimization process.
149
+
150
+ For example, if you set `--metric speedup`, your evaluation script (`eval.py` in the examples) should output a line like:
151
+
152
+ ```
153
+ speedup: 1.5
154
+ ```
155
+
156
+ or
157
+
158
+ ```
159
+ Final speedup value = 1.5
160
+ ```
161
+
162
+ Weco will parse this output to extract the numerical value (1.5 in this case) associated with the metric name ('speedup').
163
+
164
+
165
+ ## Contributing
166
+
167
+ We welcome contributions! To get started:
168
+
169
+ 1. **Fork and Clone the Repository:**
170
+ ```bash
171
+ git clone https://github.com/WecoAI/weco-cli.git
172
+ cd weco-cli
173
+ ```
174
+
175
+ 2. **Install Development Dependencies:**
176
+ ```bash
177
+ pip install -e ".[dev]"
178
+ ```
179
+
180
+ 3. **Create a Feature Branch:**
181
+ ```bash
182
+ git checkout -b feature/your-feature-name
183
+ ```
184
+
185
+ 4. **Make Your Changes:** Ensure your code adheres to our style guidelines and includes relevant tests.
186
+
187
+ 5. **Commit and Push** your changes, then open a pull request with a clear description of your enhancements.
188
+
189
+ ---
weco-0.2.4/PKG-INFO DELETED
@@ -1,141 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: weco
3
- Version: 0.2.4
4
- Summary: Documentation for `weco`, a CLI for using Weco AI's code optimizer.
5
- Author-email: Weco AI Team <dhruv@weco.ai>
6
- License: MIT
7
- Project-URL: Homepage, https://github.com/WecoAI/weco-cli
8
- Keywords: AI,Code Optimization,Code Generation
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Operating System :: OS Independent
11
- Classifier: License :: OSI Approved :: MIT License
12
- Requires-Python: >=3.12
13
- Description-Content-Type: text/markdown
14
- License-File: LICENSE
15
- Requires-Dist: requests
16
- Requires-Dist: rich
17
- Provides-Extra: dev
18
- Requires-Dist: ruff; extra == "dev"
19
- Requires-Dist: build; extra == "dev"
20
- Requires-Dist: setuptools_scm; extra == "dev"
21
- Dynamic: license-file
22
-
23
- # Weco CLI – Code Optimizer for Machine Learning Engineers
24
-
25
- [![Python](https://img.shields.io/badge/Python-3.12.0-blue)](https://www.python.org)
26
- [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
27
-
28
- `weco` is a command-line interface for interacting with Weco AI's code optimizer, powerred by [AI-Driven Exploration](https://arxiv.org/abs/2502.13138).
29
-
30
-
31
-
32
- https://github.com/user-attachments/assets/cb724ef1-bff6-4757-b457-d3b2201ede81
33
-
34
-
35
-
36
- ---
37
-
38
- ## Overview
39
-
40
- The weco CLI leverages a tree search approach with LLMs to iteratively improve your code.
41
-
42
- ![image](https://github.com/user-attachments/assets/a6ed63fa-9c40-498e-aa98-a873e5786509)
43
-
44
-
45
-
46
- ---
47
-
48
- ## Setup
49
-
50
- 1. **Install the Package:**
51
-
52
- ```bash
53
- pip install weco
54
- ```
55
-
56
- 2. **Configure API Keys:**
57
-
58
- Set the appropriate environment variables for your language model provider:
59
-
60
- - **OpenAI:** `export OPENAI_API_KEY="your_key_here"`
61
- - **Anthropic:** `export ANTHROPIC_API_KEY="your_key_here"`
62
- - **Google DeepMind:** `export GEMINI_API_KEY="your_key_here"`
63
-
64
- ---
65
-
66
- ## Usage
67
-
68
- ### Command Line Arguments
69
-
70
- | Argument | Description | Required |
71
- |-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|----------|
72
- | `--source` | Path to the Python source code that will be optimized (e.g. optimize.py). | Yes |
73
- | `--eval-command` | Command to run for evaluation (e.g. 'python eval.py --arg1=val1'). | Yes |
74
- | `--metric` | Metric to optimize. | Yes |
75
- | `--maximize` | Whether to maximize ('true') or minimize ('false') the metric. | Yes |
76
- | `--steps` | Number of optimization steps to run. | Yes |
77
- | `--model` | Model to use for optimization. | Yes |
78
- | `--additional-instructions` | (Optional) Description of additional instructions OR path to a file containing additional instructions. | No |
79
-
80
- ---
81
-
82
- ### Example
83
-
84
- Optimizing common operations in pytorch:
85
- ```bash
86
- weco --source examples/simple-torch/optimize.py \
87
- --eval-command "python examples/simple-torch/evaluate.py --solution-path examples/simple-torch/optimize.py --device mps" \
88
- --metric speedup \
89
- --maximize true \
90
- --steps 15 \
91
- --model o3-mini \
92
- --additional-instructions "Fuse operations in the forward method while ensuring the max float deviation remains small. Maintain the same format of the code."
93
- ```
94
-
95
- Sometimes we have a bit more context we'd like to provide. Its not easy to fit all of this in a string like shown above with `additional-instructions`. Thats why you can also provide a path to any file you'd like to me read as in context. In this example, we optimize the same operations using mlx and metal with additional instructions:
96
- ```bash
97
- weco --source examples/simple-mlx/optimize.py \
98
- --eval-command "python examples/simple-mlx/evaluate.py --solution-path examples/simple-mlx/optimize.py" \
99
- --metric speedup \
100
- --maximize true \
101
- --steps 30 \
102
- --model o3-mini \
103
- --additional-instructions examples/simple-mlx/metal-examples.rst
104
- ```
105
- ---
106
-
107
- ## Supported Providers
108
-
109
- The CLI supports the following model providers:
110
-
111
- - **OpenAI:** Set your API key using `OPENAI_API_KEY`.
112
- - **Anthropic:** Set your API key using `ANTHROPIC_API_KEY`.
113
- - **Google DeepMind:** Set your API key using `GEMINI_API_KEY`.
114
-
115
- ---
116
-
117
- ## Contributing
118
-
119
- We welcome contributions! To get started:
120
-
121
- 1. **Fork and Clone the Repository:**
122
- ```bash
123
- git clone https://github.com/WecoAI/weco-cli.git
124
- cd weco-cli
125
- ```
126
-
127
- 2. **Install Development Dependencies:**
128
- ```bash
129
- pip install -e ".[dev]"
130
- ```
131
-
132
- 3. **Create a Feature Branch:**
133
- ```bash
134
- git checkout -b feature/your-feature-name
135
- ```
136
-
137
- 4. **Make Your Changes:** Ensure your code adheres to our style guidelines and includes relevant tests.
138
-
139
- 5. **Commit and Push** your changes, then open a pull request with a clear description of your enhancements.
140
-
141
- ---
weco-0.2.4/README.md DELETED
@@ -1,119 +0,0 @@
1
- # Weco CLI – Code Optimizer for Machine Learning Engineers
2
-
3
- [![Python](https://img.shields.io/badge/Python-3.12.0-blue)](https://www.python.org)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
5
-
6
- `weco` is a command-line interface for interacting with Weco AI's code optimizer, powerred by [AI-Driven Exploration](https://arxiv.org/abs/2502.13138).
7
-
8
-
9
-
10
- https://github.com/user-attachments/assets/cb724ef1-bff6-4757-b457-d3b2201ede81
11
-
12
-
13
-
14
- ---
15
-
16
- ## Overview
17
-
18
- The weco CLI leverages a tree search approach with LLMs to iteratively improve your code.
19
-
20
- ![image](https://github.com/user-attachments/assets/a6ed63fa-9c40-498e-aa98-a873e5786509)
21
-
22
-
23
-
24
- ---
25
-
26
- ## Setup
27
-
28
- 1. **Install the Package:**
29
-
30
- ```bash
31
- pip install weco
32
- ```
33
-
34
- 2. **Configure API Keys:**
35
-
36
- Set the appropriate environment variables for your language model provider:
37
-
38
- - **OpenAI:** `export OPENAI_API_KEY="your_key_here"`
39
- - **Anthropic:** `export ANTHROPIC_API_KEY="your_key_here"`
40
- - **Google DeepMind:** `export GEMINI_API_KEY="your_key_here"`
41
-
42
- ---
43
-
44
- ## Usage
45
-
46
- ### Command Line Arguments
47
-
48
- | Argument | Description | Required |
49
- |-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|----------|
50
- | `--source` | Path to the Python source code that will be optimized (e.g. optimize.py). | Yes |
51
- | `--eval-command` | Command to run for evaluation (e.g. 'python eval.py --arg1=val1'). | Yes |
52
- | `--metric` | Metric to optimize. | Yes |
53
- | `--maximize` | Whether to maximize ('true') or minimize ('false') the metric. | Yes |
54
- | `--steps` | Number of optimization steps to run. | Yes |
55
- | `--model` | Model to use for optimization. | Yes |
56
- | `--additional-instructions` | (Optional) Description of additional instructions OR path to a file containing additional instructions. | No |
57
-
58
- ---
59
-
60
- ### Example
61
-
62
- Optimizing common operations in pytorch:
63
- ```bash
64
- weco --source examples/simple-torch/optimize.py \
65
- --eval-command "python examples/simple-torch/evaluate.py --solution-path examples/simple-torch/optimize.py --device mps" \
66
- --metric speedup \
67
- --maximize true \
68
- --steps 15 \
69
- --model o3-mini \
70
- --additional-instructions "Fuse operations in the forward method while ensuring the max float deviation remains small. Maintain the same format of the code."
71
- ```
72
-
73
- Sometimes we have a bit more context we'd like to provide. Its not easy to fit all of this in a string like shown above with `additional-instructions`. Thats why you can also provide a path to any file you'd like to me read as in context. In this example, we optimize the same operations using mlx and metal with additional instructions:
74
- ```bash
75
- weco --source examples/simple-mlx/optimize.py \
76
- --eval-command "python examples/simple-mlx/evaluate.py --solution-path examples/simple-mlx/optimize.py" \
77
- --metric speedup \
78
- --maximize true \
79
- --steps 30 \
80
- --model o3-mini \
81
- --additional-instructions examples/simple-mlx/metal-examples.rst
82
- ```
83
- ---
84
-
85
- ## Supported Providers
86
-
87
- The CLI supports the following model providers:
88
-
89
- - **OpenAI:** Set your API key using `OPENAI_API_KEY`.
90
- - **Anthropic:** Set your API key using `ANTHROPIC_API_KEY`.
91
- - **Google DeepMind:** Set your API key using `GEMINI_API_KEY`.
92
-
93
- ---
94
-
95
- ## Contributing
96
-
97
- We welcome contributions! To get started:
98
-
99
- 1. **Fork and Clone the Repository:**
100
- ```bash
101
- git clone https://github.com/WecoAI/weco-cli.git
102
- cd weco-cli
103
- ```
104
-
105
- 2. **Install Development Dependencies:**
106
- ```bash
107
- pip install -e ".[dev]"
108
- ```
109
-
110
- 3. **Create a Feature Branch:**
111
- ```bash
112
- git checkout -b feature/your-feature-name
113
- ```
114
-
115
- 4. **Make Your Changes:** Ensure your code adheres to our style guidelines and includes relevant tests.
116
-
117
- 5. **Commit and Push** your changes, then open a pull request with a clear description of your enhancements.
118
-
119
- ---
@@ -1,141 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: weco
3
- Version: 0.2.4
4
- Summary: Documentation for `weco`, a CLI for using Weco AI's code optimizer.
5
- Author-email: Weco AI Team <dhruv@weco.ai>
6
- License: MIT
7
- Project-URL: Homepage, https://github.com/WecoAI/weco-cli
8
- Keywords: AI,Code Optimization,Code Generation
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Operating System :: OS Independent
11
- Classifier: License :: OSI Approved :: MIT License
12
- Requires-Python: >=3.12
13
- Description-Content-Type: text/markdown
14
- License-File: LICENSE
15
- Requires-Dist: requests
16
- Requires-Dist: rich
17
- Provides-Extra: dev
18
- Requires-Dist: ruff; extra == "dev"
19
- Requires-Dist: build; extra == "dev"
20
- Requires-Dist: setuptools_scm; extra == "dev"
21
- Dynamic: license-file
22
-
23
- # Weco CLI – Code Optimizer for Machine Learning Engineers
24
-
25
- [![Python](https://img.shields.io/badge/Python-3.12.0-blue)](https://www.python.org)
26
- [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
27
-
28
- `weco` is a command-line interface for interacting with Weco AI's code optimizer, powerred by [AI-Driven Exploration](https://arxiv.org/abs/2502.13138).
29
-
30
-
31
-
32
- https://github.com/user-attachments/assets/cb724ef1-bff6-4757-b457-d3b2201ede81
33
-
34
-
35
-
36
- ---
37
-
38
- ## Overview
39
-
40
- The weco CLI leverages a tree search approach with LLMs to iteratively improve your code.
41
-
42
- ![image](https://github.com/user-attachments/assets/a6ed63fa-9c40-498e-aa98-a873e5786509)
43
-
44
-
45
-
46
- ---
47
-
48
- ## Setup
49
-
50
- 1. **Install the Package:**
51
-
52
- ```bash
53
- pip install weco
54
- ```
55
-
56
- 2. **Configure API Keys:**
57
-
58
- Set the appropriate environment variables for your language model provider:
59
-
60
- - **OpenAI:** `export OPENAI_API_KEY="your_key_here"`
61
- - **Anthropic:** `export ANTHROPIC_API_KEY="your_key_here"`
62
- - **Google DeepMind:** `export GEMINI_API_KEY="your_key_here"`
63
-
64
- ---
65
-
66
- ## Usage
67
-
68
- ### Command Line Arguments
69
-
70
- | Argument | Description | Required |
71
- |-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|----------|
72
- | `--source` | Path to the Python source code that will be optimized (e.g. optimize.py). | Yes |
73
- | `--eval-command` | Command to run for evaluation (e.g. 'python eval.py --arg1=val1'). | Yes |
74
- | `--metric` | Metric to optimize. | Yes |
75
- | `--maximize` | Whether to maximize ('true') or minimize ('false') the metric. | Yes |
76
- | `--steps` | Number of optimization steps to run. | Yes |
77
- | `--model` | Model to use for optimization. | Yes |
78
- | `--additional-instructions` | (Optional) Description of additional instructions OR path to a file containing additional instructions. | No |
79
-
80
- ---
81
-
82
- ### Example
83
-
84
- Optimizing common operations in pytorch:
85
- ```bash
86
- weco --source examples/simple-torch/optimize.py \
87
- --eval-command "python examples/simple-torch/evaluate.py --solution-path examples/simple-torch/optimize.py --device mps" \
88
- --metric speedup \
89
- --maximize true \
90
- --steps 15 \
91
- --model o3-mini \
92
- --additional-instructions "Fuse operations in the forward method while ensuring the max float deviation remains small. Maintain the same format of the code."
93
- ```
94
-
95
- Sometimes we have a bit more context we'd like to provide. Its not easy to fit all of this in a string like shown above with `additional-instructions`. Thats why you can also provide a path to any file you'd like to me read as in context. In this example, we optimize the same operations using mlx and metal with additional instructions:
96
- ```bash
97
- weco --source examples/simple-mlx/optimize.py \
98
- --eval-command "python examples/simple-mlx/evaluate.py --solution-path examples/simple-mlx/optimize.py" \
99
- --metric speedup \
100
- --maximize true \
101
- --steps 30 \
102
- --model o3-mini \
103
- --additional-instructions examples/simple-mlx/metal-examples.rst
104
- ```
105
- ---
106
-
107
- ## Supported Providers
108
-
109
- The CLI supports the following model providers:
110
-
111
- - **OpenAI:** Set your API key using `OPENAI_API_KEY`.
112
- - **Anthropic:** Set your API key using `ANTHROPIC_API_KEY`.
113
- - **Google DeepMind:** Set your API key using `GEMINI_API_KEY`.
114
-
115
- ---
116
-
117
- ## Contributing
118
-
119
- We welcome contributions! To get started:
120
-
121
- 1. **Fork and Clone the Repository:**
122
- ```bash
123
- git clone https://github.com/WecoAI/weco-cli.git
124
- cd weco-cli
125
- ```
126
-
127
- 2. **Install Development Dependencies:**
128
- ```bash
129
- pip install -e ".[dev]"
130
- ```
131
-
132
- 3. **Create a Feature Branch:**
133
- ```bash
134
- git checkout -b feature/your-feature-name
135
- ```
136
-
137
- 4. **Make Your Changes:** Ensure your code adheres to our style guidelines and includes relevant tests.
138
-
139
- 5. **Commit and Push** your changes, then open a pull request with a clear description of your enhancements.
140
-
141
- ---
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes