weco 0.3.1__tar.gz → 0.3.3__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.
- {weco-0.3.1 → weco-0.3.3}/.gitignore +8 -0
- {weco-0.3.1 → weco-0.3.3}/PKG-INFO +30 -95
- {weco-0.3.1 → weco-0.3.3}/README.md +28 -94
- weco-0.3.3/assets/example-optimization.gif +0 -0
- weco-0.3.3/examples/README.md +146 -0
- {weco-0.3.1 → weco-0.3.3}/examples/cuda/README.md +15 -10
- {weco-0.3.1 → weco-0.3.3}/examples/cuda/evaluate.py +13 -10
- weco-0.3.3/examples/cuda/requirements.txt +4 -0
- weco-0.3.3/examples/extract-line-plot/README.md +72 -0
- weco-0.3.3/examples/extract-line-plot/eval.py +370 -0
- weco-0.3.3/examples/extract-line-plot/guide.md +53 -0
- weco-0.3.3/examples/extract-line-plot/optimize.py +116 -0
- weco-0.3.3/examples/extract-line-plot/prepare_data.py +94 -0
- weco-0.3.3/examples/extract-line-plot/pyproject.toml +18 -0
- {weco-0.3.1/examples/hello-kernel-world → weco-0.3.3/examples/hello-world}/README.md +8 -7
- weco-0.3.3/examples/hello-world/colab_notebook_walkthrough.ipynb +277 -0
- {weco-0.3.1/examples/hello-kernel-world → weco-0.3.3/examples/hello-world}/evaluate.py +2 -2
- weco-0.3.3/examples/hello-world/requirements.txt +1 -0
- weco-0.3.3/examples/triton/README.md +42 -0
- weco-0.3.3/examples/triton/evaluate.py +107 -0
- weco-0.3.3/examples/triton/module.py +23 -0
- weco-0.3.3/examples/triton/requirements.txt +3 -0
- {weco-0.3.1 → weco-0.3.3}/pyproject.toml +2 -1
- {weco-0.3.1 → weco-0.3.3}/weco/api.py +1 -2
- {weco-0.3.1 → weco-0.3.3}/weco/cli.py +2 -2
- {weco-0.3.1 → weco-0.3.3}/weco/optimizer.py +2 -19
- {weco-0.3.1 → weco-0.3.3}/weco/utils.py +41 -11
- {weco-0.3.1 → weco-0.3.3}/weco.egg-info/PKG-INFO +30 -95
- {weco-0.3.1 → weco-0.3.3}/weco.egg-info/SOURCES.txt +15 -6
- {weco-0.3.1 → weco-0.3.3}/weco.egg-info/requires.txt +1 -0
- weco-0.3.1/assets/example-optimization.gif +0 -0
- weco-0.3.1/examples/README.md +0 -111
- weco-0.3.1/examples/hello-kernel-world/colab_notebook_walkthrough.ipynb +0 -270
- weco-0.3.1/examples/triton/README.md +0 -40
- weco-0.3.1/examples/triton/evaluate.py +0 -143
- weco-0.3.1/examples/triton/optimize.py +0 -44
- {weco-0.3.1 → weco-0.3.3}/.github/workflows/lint.yml +0 -0
- {weco-0.3.1 → weco-0.3.3}/.github/workflows/release.yml +0 -0
- {weco-0.3.1 → weco-0.3.3}/LICENSE +0 -0
- {weco-0.3.1 → weco-0.3.3}/assets/weco.svg +0 -0
- {weco-0.3.1 → weco-0.3.3}/contributing.md +0 -0
- /weco-0.3.1/examples/cuda/optimize.py → /weco-0.3.3/examples/cuda/module.py +0 -0
- /weco-0.3.1/examples/hello-kernel-world/optimize.py → /weco-0.3.3/examples/hello-world/module.py +0 -0
- {weco-0.3.1 → weco-0.3.3}/examples/prompt/README.md +0 -0
- {weco-0.3.1 → weco-0.3.3}/examples/prompt/eval.py +0 -0
- {weco-0.3.1 → weco-0.3.3}/examples/prompt/optimize.py +0 -0
- {weco-0.3.1 → weco-0.3.3}/examples/prompt/prompt_guide.md +0 -0
- {weco-0.3.1 → weco-0.3.3}/examples/spaceship-titanic/README.md +0 -0
- {weco-0.3.1 → weco-0.3.3}/examples/spaceship-titanic/competition_description.md +0 -0
- {weco-0.3.1 → weco-0.3.3}/examples/spaceship-titanic/data/sample_submission.csv +0 -0
- {weco-0.3.1 → weco-0.3.3}/examples/spaceship-titanic/data/test.csv +0 -0
- {weco-0.3.1 → weco-0.3.3}/examples/spaceship-titanic/data/train.csv +0 -0
- {weco-0.3.1 → weco-0.3.3}/examples/spaceship-titanic/evaluate.py +0 -0
- {weco-0.3.1 → weco-0.3.3}/examples/spaceship-titanic/train.py +0 -0
- {weco-0.3.1 → weco-0.3.3}/setup.cfg +0 -0
- {weco-0.3.1 → weco-0.3.3}/weco/__init__.py +0 -0
- {weco-0.3.1 → weco-0.3.3}/weco/auth.py +0 -0
- {weco-0.3.1 → weco-0.3.3}/weco/chatbot.py +0 -0
- {weco-0.3.1 → weco-0.3.3}/weco/constants.py +0 -0
- {weco-0.3.1 → weco-0.3.3}/weco/credits.py +0 -0
- {weco-0.3.1 → weco-0.3.3}/weco/panels.py +0 -0
- {weco-0.3.1 → weco-0.3.3}/weco.egg-info/dependency_links.txt +0 -0
- {weco-0.3.1 → weco-0.3.3}/weco.egg-info/entry_points.txt +0 -0
- {weco-0.3.1 → weco-0.3.3}/weco.egg-info/top_level.txt +0 -0
|
@@ -84,3 +84,11 @@ repomix-output.*
|
|
|
84
84
|
|
|
85
85
|
# Claude config
|
|
86
86
|
.claude/
|
|
87
|
+
|
|
88
|
+
# Example: extract-line-plot generated artifacts
|
|
89
|
+
examples/extract-line-plot/predictions/
|
|
90
|
+
examples/extract-line-plot/subset_line_*/
|
|
91
|
+
examples/extract-line-plot/subset_line_*.zip
|
|
92
|
+
|
|
93
|
+
# Example: prompt
|
|
94
|
+
examples/prompt/.cache
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: weco
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
4
4
|
Summary: Documentation for `weco`, a CLI for using Weco AI's code optimizer.
|
|
5
5
|
Author-email: Weco AI Team <contact@weco.ai>
|
|
6
6
|
License:
|
|
@@ -219,6 +219,7 @@ Requires-Dist: packaging
|
|
|
219
219
|
Requires-Dist: gitingest
|
|
220
220
|
Requires-Dist: fastapi
|
|
221
221
|
Requires-Dist: slowapi
|
|
222
|
+
Requires-Dist: psutil
|
|
222
223
|
Provides-Extra: dev
|
|
223
224
|
Requires-Dist: ruff; extra == "dev"
|
|
224
225
|
Requires-Dist: build; extra == "dev"
|
|
@@ -229,7 +230,7 @@ Dynamic: license-file
|
|
|
229
230
|
|
|
230
231
|
<div align="center">
|
|
231
232
|
<img src="assets/weco.svg" alt="Weco Logo" width="120" height="120" style="margin-bottom: 20px;">
|
|
232
|
-
<h1>Weco: The
|
|
233
|
+
<h1>Weco: The Code Optimization Agent</h1>
|
|
233
234
|
</div>
|
|
234
235
|
|
|
235
236
|
[](https://www.python.org)
|
|
@@ -237,7 +238,7 @@ Dynamic: license-file
|
|
|
237
238
|
[](https://docs.weco.ai/)
|
|
238
239
|
[](https://pepy.tech/projects/weco)
|
|
239
240
|
[](https://arxiv.org/abs/2502.13138)
|
|
240
|
-
[](https://colab.research.google.com/github/WecoAI/weco-cli/blob/main/examples/hello-
|
|
241
|
+
[](https://colab.research.google.com/github/WecoAI/weco-cli/blob/main/examples/hello-world/colab_notebook_walkthrough.ipynb)
|
|
241
242
|
|
|
242
243
|
`pip install weco`
|
|
243
244
|
|
|
@@ -261,77 +262,32 @@ Example applications include:
|
|
|
261
262
|
|
|
262
263
|
The `weco` CLI leverages a tree search approach guided by 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.
|
|
263
264
|
|
|
264
|
-

|
|
265
265
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
## Setup
|
|
269
|
-
|
|
270
|
-
1. **Install the Package:**
|
|
271
|
-
|
|
272
|
-
```bash
|
|
273
|
-
pip install weco
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
2. **Authenticate (Required):**
|
|
277
|
-
|
|
278
|
-
`weco` now uses a **credit-based billing system** with centralized LLM access. You need to authenticate to use the service:
|
|
279
|
-
|
|
280
|
-
- **Run the CLI**: `weco` will prompt you to authenticate via your web browser
|
|
281
|
-
- **Free Credits**: New users receive **free credits** upon signup
|
|
282
|
-
- **Centralized Keys**: All LLM provider API keys are managed by Weco (no BYOK required)
|
|
283
|
-
- **Credit Top-ups**: Purchase additional credits through the dashboard at [dashboard.weco.ai](https://dashboard.weco.ai)
|
|
284
|
-
|
|
285
|
-
---
|
|
286
|
-
|
|
287
|
-
## Get Started
|
|
288
|
-
|
|
289
|
-
### Quick Start (Recommended for New Users)
|
|
290
|
-
|
|
291
|
-
The easiest way to get started with Weco is to use the **interactive copilot**. Simply navigate to your project directory and run:
|
|
292
|
-
|
|
293
|
-
```bash
|
|
294
|
-
weco
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
Or specify a project path:
|
|
266
|
+
## Install the Package
|
|
298
267
|
|
|
299
268
|
```bash
|
|
300
|
-
weco
|
|
269
|
+
pip install weco
|
|
301
270
|
```
|
|
302
271
|
|
|
303
|
-
|
|
272
|
+
## Getting Started
|
|
304
273
|
|
|
305
|
-
|
|
306
|
-
2. **Suggest specific optimizations** tailored to your code (e.g., GPU kernel optimization, model improvements, prompt engineering)
|
|
307
|
-
3. **Generate evaluation scripts** automatically or help you configure existing ones
|
|
308
|
-
4. **Set up the complete optimization pipeline** with appropriate metrics and commands
|
|
309
|
-
5. **Run the optimization** or provide you with the exact command to execute
|
|
310
|
-
|
|
311
|
-
<div style="background-color: #fff3cd; border: 1px solid #ffeeba; padding: 15px; border-radius: 4px; margin-bottom: 15px;">
|
|
312
|
-
<strong>⚠️ Warning: Code Modification</strong><br>
|
|
313
|
-
<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.
|
|
314
|
-
</div>
|
|
315
|
-
|
|
316
|
-
### Manual Setup
|
|
274
|
+
### Quickstart with an example project
|
|
317
275
|
|
|
318
276
|
**Configure optimization parameters yourself** - If you need precise control over the optimization parameters, you can use the direct `weco run` command:
|
|
319
277
|
|
|
320
278
|
**Example: Optimizing Simple PyTorch Operations**
|
|
321
279
|
|
|
322
280
|
```bash
|
|
323
|
-
|
|
324
|
-
cd examples/hello-
|
|
325
|
-
|
|
326
|
-
# Install dependencies
|
|
327
|
-
pip install torch
|
|
281
|
+
git clone https://github.com/WecoAI/weco-cli.git
|
|
282
|
+
cd weco-cli/examples/hello-world/
|
|
283
|
+
pip install -r requirements.txt
|
|
328
284
|
|
|
329
|
-
# Run Weco with
|
|
330
|
-
weco run --source
|
|
331
|
-
--eval-command "python evaluate.py --
|
|
285
|
+
# Run Weco with configuration
|
|
286
|
+
weco run --source module.py \
|
|
287
|
+
--eval-command "python evaluate.py --path module.py" \
|
|
332
288
|
--metric speedup \
|
|
333
289
|
--goal maximize \
|
|
334
|
-
--steps
|
|
290
|
+
--steps 10 \
|
|
335
291
|
--additional-instructions "Fuse operations in the forward method while ensuring the max float deviation remains small. Maintain the same format of the code."
|
|
336
292
|
```
|
|
337
293
|
|
|
@@ -361,7 +317,7 @@ For more advanced examples, including [Triton](/examples/triton/README.md), [CUD
|
|
|
361
317
|
| Argument | Description | Default | Example |
|
|
362
318
|
| :----------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------ |
|
|
363
319
|
| `-n, --steps` | Number of optimization steps (LLM iterations) to run. | 100 | `-n 50` |
|
|
364
|
-
| `-M, --model` | Model identifier for the LLM to use (e.g., `o4-mini`, `claude-sonnet-4-
|
|
320
|
+
| `-M, --model` | Model identifier for the LLM to use (e.g., `o4-mini`, `claude-sonnet-4-5`, `gpt-5`). | `o4-mini` | `-M o4-mini` |
|
|
365
321
|
| `-i, --additional-instructions`| Natural language description of specific instructions **or** path to a file containing detailed instructions to guide the LLM. Supported file formats include - `.txt`, `.md`, and `.rst`. | `None` | `-i instructions.md` or `-i "Optimize the model for faster inference"`|
|
|
366
322
|
| `-l, --log-dir` | Path to the directory to log intermediate steps and final optimization result. | `.runs/` | `-l ./logs/` |
|
|
367
323
|
| `--eval-timeout` | Timeout in seconds for each step in evaluation. | No timeout (unlimited) | `--eval-timeout 3600` |
|
|
@@ -369,37 +325,12 @@ For more advanced examples, including [Triton](/examples/triton/README.md), [CUD
|
|
|
369
325
|
|
|
370
326
|
---
|
|
371
327
|
|
|
372
|
-
### Authentication & Dashboard
|
|
373
|
-
|
|
374
|
-
The CLI requires a Weco account for authentication and billing.
|
|
375
|
-
|
|
376
|
-
#### Credit-Based Authentication (Required)
|
|
377
|
-
Weco now requires authentication for all operations. This enables our credit-based billing system and provides access to powerful optimizations:
|
|
378
|
-
|
|
379
|
-
1. **During onboarding**: When you run `weco` for the first time, you'll be prompted to log in
|
|
380
|
-
2. **Manual login**: Use `weco logout` to clear credentials, then run `weco` again to re-authenticate
|
|
381
|
-
3. **Device flow**: Weco will open your browser automatically and guide you through a secure OAuth-style authentication
|
|
382
|
-
|
|
383
|
-

|
|
384
|
-
|
|
385
|
-
**Benefits:**
|
|
386
|
-
- **No API Key Management**: All LLM provider keys are managed centrally
|
|
387
|
-
- **Cost Transparency**: See exactly how many credits each optimization consumes
|
|
388
|
-
- **Free Trial**: Free credits to get started with optimization projects
|
|
389
|
-
- **Run History**: View all your optimization runs on the Weco dashboard
|
|
390
|
-
- **Progress Tracking**: Monitor long-running optimizations remotely
|
|
391
|
-
- **Budget Control**: Set spending limits and auto top-up preferences
|
|
392
|
-
|
|
393
|
-
---
|
|
394
|
-
|
|
395
328
|
## Command Reference
|
|
396
329
|
|
|
397
330
|
### Basic Usage Patterns
|
|
398
331
|
|
|
399
332
|
| Command | Description | When to Use |
|
|
400
333
|
|---------|-------------|-------------|
|
|
401
|
-
| `weco` | Launch interactive onboarding | **Recommended for beginners** - Analyzes your codebase and guides you through setup |
|
|
402
|
-
| `weco /path/to/project` | Launch onboarding for specific project | When working with a project in a different directory |
|
|
403
334
|
| `weco run [options]` | Direct optimization execution | **For advanced users** - When you know exactly what to optimize and how |
|
|
404
335
|
| `weco resume <run-id>` | Resume an interrupted run | Continue from the last completed step |
|
|
405
336
|
| `weco logout` | Clear authentication credentials | To switch accounts or troubleshoot authentication issues |
|
|
@@ -409,19 +340,23 @@ Weco now requires authentication for all operations. This enables our credit-bas
|
|
|
409
340
|
You can specify which LLM model to use with the `-M` or `--model` flag:
|
|
410
341
|
|
|
411
342
|
```bash
|
|
412
|
-
|
|
413
|
-
weco --model gpt-4o
|
|
414
|
-
|
|
415
|
-
# Use with direct execution
|
|
416
|
-
weco run --model claude-3.5-sonnet --source optimize.py [other options...]
|
|
343
|
+
weco run --model gpt-5 --source optimize.py [other options...]
|
|
417
344
|
```
|
|
418
345
|
|
|
419
|
-
**Available models:**
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
- `
|
|
346
|
+
**Available models (30 total):**
|
|
347
|
+
|
|
348
|
+
**OpenAI Models:**
|
|
349
|
+
- GPT-5 Series: `gpt-5.1`, `gpt-5.1-codex`, `gpt-5.1-codex-mini`, `gpt-5-codex`, `gpt-5-pro`, `gpt-5`, `gpt-5-mini`, `gpt-5-nano`
|
|
350
|
+
- O-Series Reasoning: `o3-pro`, `o3`, `o3-mini`, `o4-mini`, `o1-pro`, `o1`, `codex-mini-latest`
|
|
351
|
+
- GPT-4 Series: `gpt-4.1`, `gpt-4.1-mini`, `gpt-4.1-nano`, `gpt-4o`, `gpt-4o-mini`
|
|
352
|
+
|
|
353
|
+
**Anthropic Claude (via Vertex AI):**
|
|
354
|
+
- `claude-opus-4-5`, `claude-opus-4-1`, `claude-opus-4`, `claude-sonnet-4-5`, `claude-sonnet-4`, `claude-haiku-4-5`
|
|
355
|
+
|
|
356
|
+
**Google Gemini:**
|
|
357
|
+
- `gemini-3-pro-preview`, `gemini-2.5-pro`, `gemini-2.5-flash`, `gemini-2.5-flash-lite`
|
|
423
358
|
|
|
424
|
-
All models are available through Weco
|
|
359
|
+
All models are available through Weco. If no model is specified, Weco automatically selects the best model for your optimization task.
|
|
425
360
|
|
|
426
361
|
---
|
|
427
362
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
<img src="assets/weco.svg" alt="Weco Logo" width="120" height="120" style="margin-bottom: 20px;">
|
|
5
|
-
<h1>Weco: The
|
|
5
|
+
<h1>Weco: The Code Optimization Agent</h1>
|
|
6
6
|
</div>
|
|
7
7
|
|
|
8
8
|
[](https://www.python.org)
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
[](https://docs.weco.ai/)
|
|
11
11
|
[](https://pepy.tech/projects/weco)
|
|
12
12
|
[](https://arxiv.org/abs/2502.13138)
|
|
13
|
-
[](https://colab.research.google.com/github/WecoAI/weco-cli/blob/main/examples/hello-
|
|
13
|
+
[](https://colab.research.google.com/github/WecoAI/weco-cli/blob/main/examples/hello-world/colab_notebook_walkthrough.ipynb)
|
|
14
14
|
|
|
15
15
|
`pip install weco`
|
|
16
16
|
|
|
@@ -34,77 +34,32 @@ Example applications include:
|
|
|
34
34
|
|
|
35
35
|
The `weco` CLI leverages a tree search approach guided by 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.
|
|
36
36
|
|
|
37
|
-

|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## Setup
|
|
42
|
-
|
|
43
|
-
1. **Install the Package:**
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
pip install weco
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
2. **Authenticate (Required):**
|
|
50
|
-
|
|
51
|
-
`weco` now uses a **credit-based billing system** with centralized LLM access. You need to authenticate to use the service:
|
|
52
|
-
|
|
53
|
-
- **Run the CLI**: `weco` will prompt you to authenticate via your web browser
|
|
54
|
-
- **Free Credits**: New users receive **free credits** upon signup
|
|
55
|
-
- **Centralized Keys**: All LLM provider API keys are managed by Weco (no BYOK required)
|
|
56
|
-
- **Credit Top-ups**: Purchase additional credits through the dashboard at [dashboard.weco.ai](https://dashboard.weco.ai)
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## Get Started
|
|
61
|
-
|
|
62
|
-
### Quick Start (Recommended for New Users)
|
|
63
|
-
|
|
64
|
-
The easiest way to get started with Weco is to use the **interactive copilot**. Simply navigate to your project directory and run:
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
weco
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
Or specify a project path:
|
|
38
|
+
## Install the Package
|
|
71
39
|
|
|
72
40
|
```bash
|
|
73
|
-
weco
|
|
41
|
+
pip install weco
|
|
74
42
|
```
|
|
75
43
|
|
|
76
|
-
|
|
44
|
+
## Getting Started
|
|
77
45
|
|
|
78
|
-
|
|
79
|
-
2. **Suggest specific optimizations** tailored to your code (e.g., GPU kernel optimization, model improvements, prompt engineering)
|
|
80
|
-
3. **Generate evaluation scripts** automatically or help you configure existing ones
|
|
81
|
-
4. **Set up the complete optimization pipeline** with appropriate metrics and commands
|
|
82
|
-
5. **Run the optimization** or provide you with the exact command to execute
|
|
83
|
-
|
|
84
|
-
<div style="background-color: #fff3cd; border: 1px solid #ffeeba; padding: 15px; border-radius: 4px; margin-bottom: 15px;">
|
|
85
|
-
<strong>⚠️ Warning: Code Modification</strong><br>
|
|
86
|
-
<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.
|
|
87
|
-
</div>
|
|
88
|
-
|
|
89
|
-
### Manual Setup
|
|
46
|
+
### Quickstart with an example project
|
|
90
47
|
|
|
91
48
|
**Configure optimization parameters yourself** - If you need precise control over the optimization parameters, you can use the direct `weco run` command:
|
|
92
49
|
|
|
93
50
|
**Example: Optimizing Simple PyTorch Operations**
|
|
94
51
|
|
|
95
52
|
```bash
|
|
96
|
-
|
|
97
|
-
cd examples/hello-
|
|
98
|
-
|
|
99
|
-
# Install dependencies
|
|
100
|
-
pip install torch
|
|
53
|
+
git clone https://github.com/WecoAI/weco-cli.git
|
|
54
|
+
cd weco-cli/examples/hello-world/
|
|
55
|
+
pip install -r requirements.txt
|
|
101
56
|
|
|
102
|
-
# Run Weco with
|
|
103
|
-
weco run --source
|
|
104
|
-
--eval-command "python evaluate.py --
|
|
57
|
+
# Run Weco with configuration
|
|
58
|
+
weco run --source module.py \
|
|
59
|
+
--eval-command "python evaluate.py --path module.py" \
|
|
105
60
|
--metric speedup \
|
|
106
61
|
--goal maximize \
|
|
107
|
-
--steps
|
|
62
|
+
--steps 10 \
|
|
108
63
|
--additional-instructions "Fuse operations in the forward method while ensuring the max float deviation remains small. Maintain the same format of the code."
|
|
109
64
|
```
|
|
110
65
|
|
|
@@ -134,7 +89,7 @@ For more advanced examples, including [Triton](/examples/triton/README.md), [CUD
|
|
|
134
89
|
| Argument | Description | Default | Example |
|
|
135
90
|
| :----------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------ |
|
|
136
91
|
| `-n, --steps` | Number of optimization steps (LLM iterations) to run. | 100 | `-n 50` |
|
|
137
|
-
| `-M, --model` | Model identifier for the LLM to use (e.g., `o4-mini`, `claude-sonnet-4-
|
|
92
|
+
| `-M, --model` | Model identifier for the LLM to use (e.g., `o4-mini`, `claude-sonnet-4-5`, `gpt-5`). | `o4-mini` | `-M o4-mini` |
|
|
138
93
|
| `-i, --additional-instructions`| Natural language description of specific instructions **or** path to a file containing detailed instructions to guide the LLM. Supported file formats include - `.txt`, `.md`, and `.rst`. | `None` | `-i instructions.md` or `-i "Optimize the model for faster inference"`|
|
|
139
94
|
| `-l, --log-dir` | Path to the directory to log intermediate steps and final optimization result. | `.runs/` | `-l ./logs/` |
|
|
140
95
|
| `--eval-timeout` | Timeout in seconds for each step in evaluation. | No timeout (unlimited) | `--eval-timeout 3600` |
|
|
@@ -142,37 +97,12 @@ For more advanced examples, including [Triton](/examples/triton/README.md), [CUD
|
|
|
142
97
|
|
|
143
98
|
---
|
|
144
99
|
|
|
145
|
-
### Authentication & Dashboard
|
|
146
|
-
|
|
147
|
-
The CLI requires a Weco account for authentication and billing.
|
|
148
|
-
|
|
149
|
-
#### Credit-Based Authentication (Required)
|
|
150
|
-
Weco now requires authentication for all operations. This enables our credit-based billing system and provides access to powerful optimizations:
|
|
151
|
-
|
|
152
|
-
1. **During onboarding**: When you run `weco` for the first time, you'll be prompted to log in
|
|
153
|
-
2. **Manual login**: Use `weco logout` to clear credentials, then run `weco` again to re-authenticate
|
|
154
|
-
3. **Device flow**: Weco will open your browser automatically and guide you through a secure OAuth-style authentication
|
|
155
|
-
|
|
156
|
-

|
|
157
|
-
|
|
158
|
-
**Benefits:**
|
|
159
|
-
- **No API Key Management**: All LLM provider keys are managed centrally
|
|
160
|
-
- **Cost Transparency**: See exactly how many credits each optimization consumes
|
|
161
|
-
- **Free Trial**: Free credits to get started with optimization projects
|
|
162
|
-
- **Run History**: View all your optimization runs on the Weco dashboard
|
|
163
|
-
- **Progress Tracking**: Monitor long-running optimizations remotely
|
|
164
|
-
- **Budget Control**: Set spending limits and auto top-up preferences
|
|
165
|
-
|
|
166
|
-
---
|
|
167
|
-
|
|
168
100
|
## Command Reference
|
|
169
101
|
|
|
170
102
|
### Basic Usage Patterns
|
|
171
103
|
|
|
172
104
|
| Command | Description | When to Use |
|
|
173
105
|
|---------|-------------|-------------|
|
|
174
|
-
| `weco` | Launch interactive onboarding | **Recommended for beginners** - Analyzes your codebase and guides you through setup |
|
|
175
|
-
| `weco /path/to/project` | Launch onboarding for specific project | When working with a project in a different directory |
|
|
176
106
|
| `weco run [options]` | Direct optimization execution | **For advanced users** - When you know exactly what to optimize and how |
|
|
177
107
|
| `weco resume <run-id>` | Resume an interrupted run | Continue from the last completed step |
|
|
178
108
|
| `weco logout` | Clear authentication credentials | To switch accounts or troubleshoot authentication issues |
|
|
@@ -182,19 +112,23 @@ Weco now requires authentication for all operations. This enables our credit-bas
|
|
|
182
112
|
You can specify which LLM model to use with the `-M` or `--model` flag:
|
|
183
113
|
|
|
184
114
|
```bash
|
|
185
|
-
|
|
186
|
-
weco --model gpt-4o
|
|
187
|
-
|
|
188
|
-
# Use with direct execution
|
|
189
|
-
weco run --model claude-3.5-sonnet --source optimize.py [other options...]
|
|
115
|
+
weco run --model gpt-5 --source optimize.py [other options...]
|
|
190
116
|
```
|
|
191
117
|
|
|
192
|
-
**Available models:**
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
- `
|
|
118
|
+
**Available models (30 total):**
|
|
119
|
+
|
|
120
|
+
**OpenAI Models:**
|
|
121
|
+
- GPT-5 Series: `gpt-5.1`, `gpt-5.1-codex`, `gpt-5.1-codex-mini`, `gpt-5-codex`, `gpt-5-pro`, `gpt-5`, `gpt-5-mini`, `gpt-5-nano`
|
|
122
|
+
- O-Series Reasoning: `o3-pro`, `o3`, `o3-mini`, `o4-mini`, `o1-pro`, `o1`, `codex-mini-latest`
|
|
123
|
+
- GPT-4 Series: `gpt-4.1`, `gpt-4.1-mini`, `gpt-4.1-nano`, `gpt-4o`, `gpt-4o-mini`
|
|
124
|
+
|
|
125
|
+
**Anthropic Claude (via Vertex AI):**
|
|
126
|
+
- `claude-opus-4-5`, `claude-opus-4-1`, `claude-opus-4`, `claude-sonnet-4-5`, `claude-sonnet-4`, `claude-haiku-4-5`
|
|
127
|
+
|
|
128
|
+
**Google Gemini:**
|
|
129
|
+
- `gemini-3-pro-preview`, `gemini-2.5-pro`, `gemini-2.5-flash`, `gemini-2.5-flash-lite`
|
|
196
130
|
|
|
197
|
-
All models are available through Weco
|
|
131
|
+
All models are available through Weco. If no model is specified, Weco automatically selects the best model for your optimization task.
|
|
198
132
|
|
|
199
133
|
---
|
|
200
134
|
|
|
Binary file
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
## Weco Examples
|
|
2
|
+
|
|
3
|
+
Explore runnable examples that show how to use Weco to optimize ML models, prompts, and GPU kernels. Pick an example and get going in minutes.
|
|
4
|
+
|
|
5
|
+
### Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Weco Examples](#weco-examples)
|
|
8
|
+
- [Table of Contents](#table-of-contents)
|
|
9
|
+
- [Prerequisites](#prerequisites)
|
|
10
|
+
- [Examples at a glance](#examples-at-a-glance)
|
|
11
|
+
- [Quick starts](#quick-starts)
|
|
12
|
+
- [🧭 Hello World](#-hello-world)
|
|
13
|
+
- [⚡ Triton Optimization](#-triton-optimization)
|
|
14
|
+
- [🚀 CUDA Optimization](#-cuda-optimization)
|
|
15
|
+
- [🧠 Prompt Engineering](#-prompt-engineering)
|
|
16
|
+
- [📊 Extract Line Plot — Chart to CSV](#-extract-line-plot--chart-to-csv)
|
|
17
|
+
- [🛰️ Model Development — Spaceship Titanic](#️-model-development--spaceship-titanic)
|
|
18
|
+
|
|
19
|
+
### Prerequisites
|
|
20
|
+
|
|
21
|
+
- **Install the CLI**
|
|
22
|
+
```bash
|
|
23
|
+
pip install weco
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Examples at a glance
|
|
27
|
+
|
|
28
|
+
| Example | Focus | Dependencies | Docs |
|
|
29
|
+
| :-- | :-- | :-- | :-- |
|
|
30
|
+
| 🧭 Hello World | Learn the Weco workflow on a small PyTorch model | `torch` | [README](hello-world/README.md) • [Colab](hello-world/colab_notebook_walkthrough.ipynb) |
|
|
31
|
+
| ⚡ Triton Optimization | Speed up attention with Triton kernels | `numpy`, `torch`, `triton`, NVIDIA GPU | [README](triton/README.md) |
|
|
32
|
+
| 🚀 CUDA Optimization | Generate low-level CUDA kernels for max speed | `ninja`, `numpy`, `torch`, `triton`, NVIDIA GPU, CUDA Toolkit | [README](cuda/README.md) |
|
|
33
|
+
| 🧠 Prompt Engineering | Iteratively refine LLM prompts to improve accuracy | `openai`, `datasets`, OpenAI API key | [README](prompt/README.md) |
|
|
34
|
+
| 📊 Agentic Scaffolding | Optimize agentic scaffolding for chart-to-CSV extraction | `openai`, `huggingface_hub`, `uv`, OpenAI API key | [README](extract-line-plot/README.md) |
|
|
35
|
+
| 🛰️ Spaceship Titanic | Improve a Kaggle model training pipeline | `pandas`, `numpy`, `scikit-learn`, `torch`, `xgboost`, `lightgbm`, `catboost` | [README](spaceship-titanic/README.md) |
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Quick starts
|
|
40
|
+
|
|
41
|
+
Minimal commands to run each example. For full context and explanations, see the linked READMEs.
|
|
42
|
+
|
|
43
|
+
### 🧭 Hello World
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
cd examples/hello-world
|
|
47
|
+
pip install -r requirements.txt
|
|
48
|
+
weco run --source module.py \
|
|
49
|
+
--eval-command "python evaluate.py --path module.py" \
|
|
50
|
+
--metric speedup \
|
|
51
|
+
--goal maximize \
|
|
52
|
+
--steps 15 \
|
|
53
|
+
--additional-instructions "Fuse operations in the forward method while ensuring the max float deviation remains small. Maintain the same format of the code."
|
|
54
|
+
```
|
|
55
|
+
- **Tip**: Use `--device cuda` (NVIDIA GPU) or `--device mps` (Apple Silicon).
|
|
56
|
+
|
|
57
|
+
### ⚡ Triton Optimization
|
|
58
|
+
|
|
59
|
+
- **Requirements**: NVIDIA GPU
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
cd examples/triton
|
|
63
|
+
pip install -r requirements.txt
|
|
64
|
+
weco run --source module.py \
|
|
65
|
+
--eval-command "python evaluate.py --path module.py" \
|
|
66
|
+
--metric speedup \
|
|
67
|
+
--goal maximize \
|
|
68
|
+
--steps 15 \
|
|
69
|
+
--model o4-mini \
|
|
70
|
+
--additional-instructions "Use a combination of triton and pytorch to optimize the forward pass while ensuring a small max float diff. Maintain the same code interface. Do not use any fallbacks. Assume any required dependencies are installed and data is already on the gpu." \
|
|
71
|
+
--eval-timeout 120
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 🚀 CUDA Optimization
|
|
75
|
+
|
|
76
|
+
- **Requirements**: NVIDIA GPU and CUDA Toolkit
|
|
77
|
+
- **Optional**: If compatible, install [flash attention](https://github.com/Dao-AILab/flash-attention?tab=readme-ov-file#installation-and-features) (`pip install flash-attn --no-build-isolation`)
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
cd examples/cuda
|
|
81
|
+
pip install -r requirements.txt
|
|
82
|
+
weco run --source module.py \
|
|
83
|
+
--eval-command "python evaluate.py --path module.py" \
|
|
84
|
+
--metric speedup \
|
|
85
|
+
--goal maximize \
|
|
86
|
+
--steps 50 \
|
|
87
|
+
--model gpt-5 \
|
|
88
|
+
--additional-instructions "Write in-line CUDA using pytorch's load_inline() to optimize the code while ensuring a small max float diff. Maintain the same code interface. Do not use any fallbacks and never use the build_directory arg for load_inline(). Assume any required dependencies are installed and data is already on the gpu." \
|
|
89
|
+
--eval-timeout 600
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 🧠 Prompt Engineering
|
|
93
|
+
|
|
94
|
+
- **Requirements**: OpenAI API key (create [here](https://platform.openai.com/api-keys))
|
|
95
|
+
- **Install Dependencies**: `pip install openai datasets`
|
|
96
|
+
- **Run**:
|
|
97
|
+
```bash
|
|
98
|
+
cd examples/prompt
|
|
99
|
+
export OPENAI_API_KEY="your_key_here"
|
|
100
|
+
weco run --source optimize.py \
|
|
101
|
+
--eval-command "python eval.py" \
|
|
102
|
+
--metric score \
|
|
103
|
+
--goal maximize \
|
|
104
|
+
--steps 20 \
|
|
105
|
+
--model o4-mini \
|
|
106
|
+
--additional-instructions "Improve the prompt to get better scores. Focus on clarity, specificity, and effective prompt engineering techniques."
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 📊 Extract Line Plot — Chart to CSV
|
|
110
|
+
|
|
111
|
+
- **Requirements**: OpenAI API key (create [here](https://platform.openai.com/api-keys))
|
|
112
|
+
- **Install Dependencies**: `pip install uv openai huggingface_hub`
|
|
113
|
+
- **Run**:
|
|
114
|
+
```bash
|
|
115
|
+
cd examples/extract-line-plot
|
|
116
|
+
export OPENAI_API_KEY="your_key_here"
|
|
117
|
+
uv run --with huggingface_hub python prepare_data.py # prepare dataset
|
|
118
|
+
weco run --source optimize.py \
|
|
119
|
+
--eval-command 'uv run --with openai python eval.py --max-samples 100 --num-workers 50' \
|
|
120
|
+
--metric accuracy \
|
|
121
|
+
--goal maximize \
|
|
122
|
+
--steps 20 \
|
|
123
|
+
--model gpt-5
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### 🛰️ Model Development — Spaceship Titanic
|
|
127
|
+
|
|
128
|
+
- **Install Dependencies**: `pip install pandas numpy scikit-learn torch xgboost lightgbm catboost`
|
|
129
|
+
- **Run**:
|
|
130
|
+
```bash
|
|
131
|
+
cd examples/spaceship-titanic
|
|
132
|
+
weco run --source train.py \
|
|
133
|
+
--eval-command "python evaluate.py --data-dir ./data --seed 0" \
|
|
134
|
+
--metric accuracy \
|
|
135
|
+
--goal maximize \
|
|
136
|
+
--steps 10 \
|
|
137
|
+
--model o4-mini \
|
|
138
|
+
--additional-instructions "Improve feature engineering, model choice and hyper-parameters." \
|
|
139
|
+
--log-dir .runs/spaceship-titanic
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
If you're new to Weco, start with **Hello World**, then explore **Triton** and **CUDA** for kernel engineering, **Prompt Engineering** for optimzing an LLM's prompt, **Extract Line Plot** for optimzing agentic scaffolds, or try **Spaceship Titanic** for model development.
|
|
145
|
+
|
|
146
|
+
|
|
@@ -7,34 +7,39 @@ This approach aims for low-level optimization beyond standard PyTorch or even Tr
|
|
|
7
7
|
|
|
8
8
|
Install the CLI and dependencies for the example:
|
|
9
9
|
```bash
|
|
10
|
-
pip install weco
|
|
10
|
+
pip install weco
|
|
11
|
+
pip install -r requirements.txt
|
|
11
12
|
```
|
|
12
|
-
> **Note:**
|
|
13
|
+
> **Note:**
|
|
14
|
+
> 1. This example requires a compatible NVIDIA GPU and the CUDA Toolkit installed on your system for compiling and running the generated CUDA code.
|
|
15
|
+
> 2. If compatible, install [flash attention](https://github.com/Dao-AILab/flash-attention?tab=readme-ov-file#installation-and-features) (`pip install flash-attn --no-build-isolation`).
|
|
13
16
|
|
|
14
17
|
## Run Weco
|
|
15
18
|
|
|
16
19
|
Now run Weco to optimize your code:
|
|
17
20
|
```bash
|
|
18
|
-
weco run --source
|
|
19
|
-
--eval-command "python evaluate.py --
|
|
21
|
+
weco run --source module.py \
|
|
22
|
+
--eval-command "python evaluate.py --path module.py" \
|
|
20
23
|
--metric speedup \
|
|
21
24
|
--goal maximize \
|
|
22
25
|
--steps 50 \
|
|
23
|
-
--model
|
|
24
|
-
--additional-instructions "Write in-line CUDA using pytorch's load_inline() to optimize the code while ensuring a small max float diff. Maintain the same code
|
|
26
|
+
--model gpt-5 \
|
|
27
|
+
--additional-instructions "Write in-line CUDA using pytorch's load_inline() to optimize the code while ensuring a small max float diff. Maintain the same code interface. Do not use any fallbacks and never use the build_directory arg for load_inline(). Assume any required dependencies are installed and data is already on the gpu." \
|
|
28
|
+
--eval-timeout 600
|
|
25
29
|
```
|
|
26
30
|
|
|
27
31
|
### Explanation
|
|
28
32
|
|
|
29
|
-
* `--source
|
|
30
|
-
* `--eval-command "python evaluate.py --
|
|
33
|
+
* `--source module.py`: The initial PyTorch self-attention code to be optimized with CUDA.
|
|
34
|
+
* `--eval-command "python evaluate.py --path module.py"`: Runs the evaluation script, which compiles (if necessary) and benchmarks the CUDA-enhanced code in `module.py` against a baseline, printing the `speedup`.
|
|
31
35
|
* `--metric speedup`: The optimization target metric.
|
|
32
36
|
* `--goal maximize`: Weco aims to increase the speedup.
|
|
33
37
|
* `--steps 50`: The number of optimization iterations.
|
|
34
|
-
* `--model
|
|
38
|
+
* `--model gpt-5`: The LLM used for code generation.
|
|
35
39
|
* `--additional-instructions "..."`: Provides guidance to the LLM on the optimization approach.
|
|
40
|
+
* `--eval-timeout 600`: Stop runnning the evaluation script if it does not complete in 600 seconds.
|
|
36
41
|
|
|
37
|
-
Weco will iteratively modify `
|
|
42
|
+
Weco will iteratively modify `module.py`, generating and integrating CUDA C++ code, guided by the evaluation results and the additional instructions provided.
|
|
38
43
|
|
|
39
44
|
## Next Steps
|
|
40
45
|
|