weco 0.1.10__py3-none-any.whl → 0.2.0__py3-none-any.whl
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/__init__.py +4 -4
- weco/api.py +89 -0
- weco/cli.py +333 -0
- weco/panels.py +359 -0
- weco/utils.py +114 -175
- weco-0.2.0.dist-info/METADATA +129 -0
- weco-0.2.0.dist-info/RECORD +11 -0
- {weco-0.1.10.dist-info → weco-0.2.0.dist-info}/WHEEL +1 -1
- weco-0.2.0.dist-info/entry_points.txt +2 -0
- {weco-0.1.10.dist-info → weco-0.2.0.dist-info/licenses}/LICENSE +2 -1
- weco/client.py +0 -586
- weco/constants.py +0 -4
- weco/functional.py +0 -184
- weco-0.1.10.dist-info/METADATA +0 -125
- weco-0.1.10.dist-info/RECORD +0 -10
- {weco-0.1.10.dist-info → weco-0.2.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: weco
|
|
3
|
+
Version: 0.2.0
|
|
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 – Optimize Your Code Effortlessly
|
|
24
|
+
|
|
25
|
+
[](https://www.python.org)
|
|
26
|
+
[](LICENSE)
|
|
27
|
+
|
|
28
|
+
`weco` is a powerful command-line interface for interacting with Weco AI's code optimizer. Whether you are looking to improve performance or refine code quality, our CLI streamlines your workflow for a better development experience.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Overview
|
|
33
|
+
|
|
34
|
+
The `weco` CLI leverages advanced optimization techniques and language model strategies to iteratively improve your source code. It supports multiple language models and offers a flexible configuration to suit different optimization tasks.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Setup
|
|
39
|
+
|
|
40
|
+
1. **Install the Package:**
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install weco
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
2. **Configure API Keys:**
|
|
47
|
+
|
|
48
|
+
Set the appropriate environment variables for your language model provider:
|
|
49
|
+
|
|
50
|
+
- **OpenAI:** `export OPENAI_API_KEY="your_key_here"`
|
|
51
|
+
- **Anthropic:** `export ANTHROPIC_API_KEY="your_key_here"`
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Usage
|
|
56
|
+
|
|
57
|
+
### Command Line Arguments
|
|
58
|
+
|
|
59
|
+
| Argument | Description | Required |
|
|
60
|
+
|-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|----------|
|
|
61
|
+
| `--source` | Path to the Python source code that will be optimized (e.g. optimize.py). | Yes |
|
|
62
|
+
| `--eval-command` | Command to run for evaluation (e.g. 'python eval.py --arg1=val1'). | Yes |
|
|
63
|
+
| `--metric` | Metric to optimize. | Yes |
|
|
64
|
+
| `--maximize` | Boolean flag indicating whether to maximize the metric. | Yes |
|
|
65
|
+
| `--steps` | Number of optimization steps to run. | Yes |
|
|
66
|
+
| `--model` | Model to use for optimization. | Yes |
|
|
67
|
+
| `--additional-instructions` | (Optional) Description of additional instructions or path to a file containing additional instructions. | No |
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
### Example
|
|
72
|
+
|
|
73
|
+
Optimizing common operations in pytorch:
|
|
74
|
+
```bash
|
|
75
|
+
weco --source examples/simple-torch/optimize.py \
|
|
76
|
+
--eval-command "python examples/simple-torch/evaluate.py --solution-path examples/simple-torch/optimize.py --device mps" \
|
|
77
|
+
--metric "speedup" \
|
|
78
|
+
--maximize true \
|
|
79
|
+
--steps 15 \
|
|
80
|
+
--model "o3-mini" \
|
|
81
|
+
--additional-instructions "Fuse operations in the forward method while ensuring the max float deviation remains small. Maintain the same format of the code."
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Optimizing these same using mlx and metal:
|
|
85
|
+
```bash
|
|
86
|
+
weco --source examples/simple-mlx/optimize.py \
|
|
87
|
+
--eval-command "python examples/simple-mlx/evaluate.py --solution-path examples/simple-mlx/optimize.py" \
|
|
88
|
+
--metric "speedup" \
|
|
89
|
+
--maximize true \
|
|
90
|
+
--steps 30 \
|
|
91
|
+
--model "o3-mini" \
|
|
92
|
+
--additional-instructions "examples/simple-mlx/metal-examples.rst"
|
|
93
|
+
```
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Supported Providers
|
|
97
|
+
|
|
98
|
+
The CLI supports the following model providers:
|
|
99
|
+
|
|
100
|
+
- **OpenAI:** Set your API key using `OPENAI_API_KEY`.
|
|
101
|
+
- **Anthropic:** Set your API key using `ANTHROPIC_API_KEY`.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Contributing
|
|
106
|
+
|
|
107
|
+
We welcome contributions! To get started:
|
|
108
|
+
|
|
109
|
+
1. **Fork and Clone the Repository:**
|
|
110
|
+
```bash
|
|
111
|
+
git clone https://github.com/WecoAI/weco-cli.git
|
|
112
|
+
cd weco-cli
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
2. **Install Development Dependencies:**
|
|
116
|
+
```bash
|
|
117
|
+
pip install -e ".[dev]"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
3. **Create a Feature Branch:**
|
|
121
|
+
```bash
|
|
122
|
+
git checkout -b feature/your-feature-name
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
4. **Make Your Changes:** Ensure your code adheres to our style guidelines and includes relevant tests.
|
|
126
|
+
|
|
127
|
+
5. **Commit and Push** your changes, then open a pull request with a clear description of your enhancements.
|
|
128
|
+
|
|
129
|
+
---
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
weco/__init__.py,sha256=J-pJsj20yEXYYCDJyhKJBFWQUzb4bhww0ynqxNBA5Z4,124
|
|
2
|
+
weco/api.py,sha256=JHAm60sO51Y2tzLnyAAFv9OLm75o_RNWeoK-gYF4VHE,3342
|
|
3
|
+
weco/cli.py,sha256=q1UuQ8xe2R5dpLhxPGJEW9mOFozH0oRlTbyyVD70XlU,15895
|
|
4
|
+
weco/panels.py,sha256=Cu249CAlpczrseBjqvERlo_wlg4RLbO0ylx1JPZGjRA,13058
|
|
5
|
+
weco/utils.py,sha256=yCVlQyCP0P7t-864xuw55qEUVmyXXGin-a1Y5TDFHE4,4202
|
|
6
|
+
weco-0.2.0.dist-info/licenses/LICENSE,sha256=p_GQqJBvuZgkLNboYKyH-5dhpTDlKs2wq2TVM55WrWE,1065
|
|
7
|
+
weco-0.2.0.dist-info/METADATA,sha256=piZk0o15yLjq6qpKKFQqT4vRcGR3unNC2LzZOIdJAro,5140
|
|
8
|
+
weco-0.2.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
9
|
+
weco-0.2.0.dist-info/entry_points.txt,sha256=ixJ2uClALbCpBvnIR6BXMNck8SHAab8eVkM9pIUowcs,39
|
|
10
|
+
weco-0.2.0.dist-info/top_level.txt,sha256=F0N7v6e2zBSlsorFv-arAq2yDxQbzX3KVO8GxYhPUeE,5
|
|
11
|
+
weco-0.2.0.dist-info/RECORD,,
|