Text Generation
Transformers
English
qwen2
code-generation
python
fine-tuning
Qwen
tools
agent-framework
multi-agent
conversational
Eval Results (legacy)
Instructions to use my-ai-stack/Stack-2-9-finetuned with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use my-ai-stack/Stack-2-9-finetuned with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="my-ai-stack/Stack-2-9-finetuned") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("my-ai-stack/Stack-2-9-finetuned") model = AutoModelForCausalLM.from_pretrained("my-ai-stack/Stack-2-9-finetuned") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use my-ai-stack/Stack-2-9-finetuned with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "my-ai-stack/Stack-2-9-finetuned" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "my-ai-stack/Stack-2-9-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/my-ai-stack/Stack-2-9-finetuned
- SGLang
How to use my-ai-stack/Stack-2-9-finetuned with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "my-ai-stack/Stack-2-9-finetuned" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "my-ai-stack/Stack-2-9-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "my-ai-stack/Stack-2-9-finetuned" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "my-ai-stack/Stack-2-9-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use my-ai-stack/Stack-2-9-finetuned with Docker Model Runner:
docker model run hf.co/my-ai-stack/Stack-2-9-finetuned
walidsobhie-code Claude Opus 4.6 commited on
Commit Β·
e89db64
1
Parent(s): f80360c
docs: Complete restructure README like premium AI products
Browse files- Add feature highlights table at top
- Add TUI usage examples with interactive demo
- Add programmatic usage examples
- Add configuration section with env vars and YAML
- Add development section with benchmark/training commands
- Add architecture diagram
- Organize sections logically
- Add badges and acknowledgments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
README.md
CHANGED
|
@@ -1,41 +1,38 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
|
| 5 |
-
|
| 6 |
|
| 7 |
-
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
|
| 10 |
-
- **Pattern Mining** β Extracts successful code patterns from solutions
|
| 11 |
-
- **Feedback Loop** β Learns from successes and failures
|
| 12 |
-
- **Persistent Memory** β Stores learned patterns across sessions
|
| 13 |
-
- **Continuous Improvement** β Gets smarter the more you use it
|
| 14 |
|
| 15 |
-
|
| 16 |
-
- Deep understanding of your entire project
|
| 17 |
-
- Extracts patterns from source code
|
| 18 |
-
- Applies learned knowledge to new problems
|
| 19 |
-
- Becomes your project-specific expert
|
| 20 |
|
| 21 |
-
##
|
| 22 |
-
- 37 built-in tools for coding, debugging, and shipping
|
| 23 |
-
- Natural language commands
|
| 24 |
-
- Multi-provider support (Ollama, OpenAI, Anthropic)
|
| 25 |
-
- Deploy anywhere, own your data
|
| 26 |
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|-----------|-------|-------------|
|
| 31 |
-
| **HumanEval** | 76.8% | Python code generation |
|
| 32 |
-
| **MBPP** | 82.3% | Programming problems |
|
| 33 |
-
| **Tool Use** | 94.1% | Tool calling accuracy |
|
| 34 |
-
| **Context Window** | 128K | Token context length |
|
| 35 |
|
| 36 |
## π Quick Start
|
| 37 |
|
| 38 |
-
###
|
| 39 |
|
| 40 |
```bash
|
| 41 |
# Clone the repository
|
|
@@ -44,232 +41,282 @@ cd stack-2.9
|
|
| 44 |
|
| 45 |
# Install dependencies
|
| 46 |
pip install -r requirements.txt
|
| 47 |
-
|
| 48 |
-
# Run the CLI
|
| 49 |
-
python -m stack_2_9.cli
|
| 50 |
```
|
| 51 |
|
| 52 |
-
###
|
| 53 |
|
| 54 |
```bash
|
| 55 |
-
# Start
|
| 56 |
-
|
| 57 |
|
| 58 |
-
#
|
| 59 |
-
|
| 60 |
-
export OLLAMA_MODEL=qwen2.5-coder:32b
|
| 61 |
```
|
| 62 |
|
| 63 |
-
###
|
| 64 |
|
| 65 |
```bash
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
export OPENAI_MODEL=gpt-4o
|
| 69 |
-
```
|
| 70 |
|
| 71 |
-
#
|
|
|
|
|
|
|
| 72 |
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
```
|
| 77 |
|
| 78 |
-
|
| 79 |
|
| 80 |
-
|
| 81 |
-
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 82 |
-
β Stack 2.9 β
|
| 83 |
-
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
| 84 |
-
β CLI Interface β
|
| 85 |
-
β βββ Commands (init, chat, eval, train) β
|
| 86 |
-
β βββ Tools (37 built-in) β
|
| 87 |
-
β βββ Skills System β
|
| 88 |
-
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
| 89 |
-
β Model Layer β
|
| 90 |
-
β βββ model_client.py (Ollama/OpenAI/Anthropic) β
|
| 91 |
-
β βββ Unified API for all backends β
|
| 92 |
-
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
| 93 |
-
β Training & Evolution β
|
| 94 |
-
β βββ pattern_miner.py (Pattern extraction) β
|
| 95 |
-
β βββ data_quality.py (Quality filtering) β
|
| 96 |
-
β βββ train_lora.py (Fine-tuning) β
|
| 97 |
-
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
| 98 |
-
β Evaluation β
|
| 99 |
-
β βββ benchmarks/mbpp.py (MBPP benchmark) β
|
| 100 |
-
β βββ benchmarks/human_eval.py (HumanEval) β
|
| 101 |
-
β βββ eval_pipeline.py (Full evaluation) β
|
| 102 |
-
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 103 |
-
```
|
| 104 |
|
| 105 |
-
##
|
| 106 |
|
| 107 |
```
|
| 108 |
-
stack
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
β βββ eval_pipeline.py # Evaluation orchestration
|
| 123 |
-
β βββ benchmarks/
|
| 124 |
-
β βββ mbpp.py # MBPP benchmark
|
| 125 |
-
β βββ human_eval.py # HumanEval benchmark
|
| 126 |
-
β
|
| 127 |
-
βββ stack-2.9-voice/ # Voice integration
|
| 128 |
-
β βββ voice_client.py # Voice input/output
|
| 129 |
-
β βββ voice_server.py # Voice API server
|
| 130 |
-
β
|
| 131 |
-
βββ training-data/ # Learned patterns & memory
|
| 132 |
-
β βββ synthetic/ # Synthetic training examples
|
| 133 |
-
β βββ code-pairs/ # Code pattern pairs
|
| 134 |
-
β βββ advanced-patterns/ # Complex patterns
|
| 135 |
-
β βββ tools/ # Tool definitions
|
| 136 |
-
β
|
| 137 |
-
βββ docs/ # Documentation
|
| 138 |
-
```
|
| 139 |
|
| 140 |
-
|
| 141 |
|
| 142 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
|
| 144 |
-
**Data Quality Module**
|
| 145 |
```python
|
| 146 |
-
from
|
|
|
|
| 147 |
|
| 148 |
-
|
| 149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
```
|
| 151 |
|
| 152 |
-
|
|
|
|
| 153 |
```python
|
| 154 |
-
from pattern_miner import PatternMiner
|
| 155 |
|
| 156 |
miner = PatternMiner()
|
| 157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
patterns = miner.get_relevant_patterns("sorting")
|
|
|
|
| 159 |
```
|
| 160 |
|
| 161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
|
| 163 |
-
**Run Benchmarks**
|
| 164 |
```bash
|
| 165 |
-
#
|
| 166 |
-
|
|
|
|
| 167 |
|
| 168 |
-
#
|
| 169 |
-
|
|
|
|
|
|
|
| 170 |
|
| 171 |
-
#
|
| 172 |
-
|
|
|
|
| 173 |
```
|
| 174 |
|
| 175 |
-
###
|
| 176 |
|
| 177 |
-
```
|
| 178 |
-
|
|
|
|
|
|
|
|
|
|
| 179 |
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
client = create_model_client("anthropic", "claude-sonnet-4-20250514")
|
| 184 |
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
|
|
|
|
|
|
| 188 |
```
|
| 189 |
|
| 190 |
-
|
| 191 |
|
| 192 |
-
|
| 193 |
-
2. **Learn** β Extracts patterns from successful solutions
|
| 194 |
-
3. **Store** β Saves patterns to persistent memory
|
| 195 |
-
4. **Apply** β Augments prompts with relevant patterns
|
| 196 |
-
5. **Improve** β Fine-tunes model on accumulated knowledge
|
| 197 |
|
| 198 |
-
```
|
| 199 |
-
|
| 200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
|
| 202 |
-
|
| 203 |
|
| 204 |
-
#
|
| 205 |
-
miner.store_feedback(
|
| 206 |
-
problem_type="list_comprehension",
|
| 207 |
-
solution="return [x*2 for x in lst]",
|
| 208 |
-
success=True
|
| 209 |
-
)
|
| 210 |
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
```
|
| 215 |
|
| 216 |
-
|
| 217 |
|
| 218 |
-
|
| 219 |
|
| 220 |
-
|
| 221 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 222 |
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
```
|
| 237 |
|
| 238 |
-
|
|
|
|
|
|
|
| 239 |
|
| 240 |
```bash
|
| 241 |
-
#
|
| 242 |
cd stack-2.9-deploy
|
| 243 |
docker-compose up -d
|
| 244 |
|
| 245 |
-
#
|
| 246 |
-
|
| 247 |
```
|
| 248 |
|
|
|
|
|
|
|
| 249 |
## π Documentation
|
| 250 |
|
| 251 |
- [API Reference](stack-2.9-docs/API.md)
|
| 252 |
- [Architecture](stack-2.9-docs/ARCHITECTURE.md)
|
| 253 |
- [Setup Guide](stack-2.9-docs/SETUP.md)
|
| 254 |
-
- [Contributing](
|
|
|
|
|
|
|
| 255 |
|
| 256 |
## π€ Contributing
|
| 257 |
|
| 258 |
-
Contributions are welcome! Please
|
| 259 |
|
| 260 |
1. Fork the repository
|
| 261 |
-
2. Create a feature branch
|
| 262 |
-
3.
|
| 263 |
-
4.
|
|
|
|
|
|
|
|
|
|
| 264 |
|
| 265 |
## π License
|
| 266 |
|
| 267 |
-
Apache 2.0
|
| 268 |
|
| 269 |
---
|
| 270 |
|
| 271 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 272 |
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
|
|
|
| 1 |
+
<p align="center">
|
| 2 |
+
<img src="https://img.shields.io/github/stars/my-ai-stack/stack-2.9" alt="Stars">
|
| 3 |
+
<img src="https://img.shields.io/github/license/my-ai-stack/stack-2.9" alt="License">
|
| 4 |
+
<img src="https://img.shields.io/python version/3.10+-blue" alt="Python">
|
| 5 |
+
<img src="https://img.shields.io/discord" alt="Discord">
|
| 6 |
+
</p>
|
| 7 |
|
| 8 |
+
---
|
| 9 |
|
| 10 |
+
# Stack 2.9 π€
|
| 11 |
|
| 12 |
+
<p align="center">
|
| 13 |
+
<strong>The self-evolving AI coding assistant that gets smarter with every interaction.</strong>
|
| 14 |
+
</p>
|
| 15 |
|
| 16 |
+
Stack 2.9 is an open-source AI coding assistant powered by Qwen2.5-Coder-32B. Unlike static models, Stack 2.9 learns from your code, extracts patterns from successful solutions, and continuously evolves to become your project-specific expert.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
+
## β¨ Features
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
+
| Feature | Description |
|
| 23 |
+
|---------|-------------|
|
| 24 |
+
| **π§ Self-Evolving** | Learns from every interaction. Stores patterns, tracks success rates, and improves over time |
|
| 25 |
+
| **π» Code Generation** | 76.8% HumanEval, 82.3% MBPP accuracy on code generation tasks |
|
| 26 |
+
| **π§ 37 Built-in Tools** | File ops, search, shell commands, git, and more |
|
| 27 |
+
| **π Multi-Provider** | Works with Ollama, OpenAI, Anthropic β or bring your own model |
|
| 28 |
+
| **π± Terminal UI** | Beautiful interactive CLI with chat, benchmarks, and training |
|
| 29 |
+
| **π Self-Hosted** | Run locally, own your data, deploy anywhere |
|
| 30 |
|
| 31 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
## π Quick Start
|
| 34 |
|
| 35 |
+
### Installation
|
| 36 |
|
| 37 |
```bash
|
| 38 |
# Clone the repository
|
|
|
|
| 41 |
|
| 42 |
# Install dependencies
|
| 43 |
pip install -r requirements.txt
|
|
|
|
|
|
|
|
|
|
| 44 |
```
|
| 45 |
|
| 46 |
+
### Interactive Chat
|
| 47 |
|
| 48 |
```bash
|
| 49 |
+
# Start the CLI
|
| 50 |
+
python stack.py
|
| 51 |
|
| 52 |
+
# Or use the module
|
| 53 |
+
python -m stack_cli.cli
|
|
|
|
| 54 |
```
|
| 55 |
|
| 56 |
+
### Quick Commands
|
| 57 |
|
| 58 |
```bash
|
| 59 |
+
# Run a single query
|
| 60 |
+
python stack.py -c "Write a hello world function in Python"
|
|
|
|
|
|
|
| 61 |
|
| 62 |
+
# Run benchmarks
|
| 63 |
+
python stack.py --eval all --provider ollama
|
| 64 |
+
python stack.py --eval mbpp --provider openai --model gpt-4o
|
| 65 |
|
| 66 |
+
# View learned patterns
|
| 67 |
+
python stack.py --patterns list
|
| 68 |
+
python stack.py --patterns stats
|
| 69 |
```
|
| 70 |
|
| 71 |
+
---
|
| 72 |
|
| 73 |
+
## π» Usage Examples
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
+
### Chat Mode
|
| 76 |
|
| 77 |
```
|
| 78 |
+
$ python stack.py
|
| 79 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 80 |
+
β Stack 2.9 - Self-Evolving AI β
|
| 81 |
+
β Your AI coding companion β
|
| 82 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 83 |
+
|
| 84 |
+
Main Menu:
|
| 85 |
+
[1] Chat with Stack 2.9
|
| 86 |
+
[2] Run Evaluation
|
| 87 |
+
[3] Manage Patterns
|
| 88 |
+
[4] Train Model
|
| 89 |
+
[5] Settings
|
| 90 |
+
|
| 91 |
+
Select> 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
+
[Stack]> Write a function to reverse a string in Python
|
| 94 |
|
| 95 |
+
Here's a simple implementation:
|
| 96 |
+
|
| 97 |
+
def reverse_string(s):
|
| 98 |
+
return s[::-1]
|
| 99 |
+
|
| 100 |
+
You: exit
|
| 101 |
+
Goodbye!
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
### Programmatic Usage
|
| 105 |
|
|
|
|
| 106 |
```python
|
| 107 |
+
from stack_cli.cli import StackCLI
|
| 108 |
+
from stack_cli.agent import create_agent
|
| 109 |
|
| 110 |
+
# Direct agent usage
|
| 111 |
+
agent = create_agent()
|
| 112 |
+
response = agent.process("Write a hello world in Python")
|
| 113 |
+
print(response.content)
|
| 114 |
+
|
| 115 |
+
# Or use the model client directly
|
| 116 |
+
from stack_2_9_eval.model_client import create_model_client
|
| 117 |
+
|
| 118 |
+
client = create_model_client("ollama", "qwen2.5-coder:32b")
|
| 119 |
+
result = client.generate("Write a function to reverse a string")
|
| 120 |
+
print(result.text)
|
| 121 |
```
|
| 122 |
|
| 123 |
+
### Pattern Mining (Self-Evolution)
|
| 124 |
+
|
| 125 |
```python
|
| 126 |
+
from stack_2_9_training.pattern_miner import PatternMiner
|
| 127 |
|
| 128 |
miner = PatternMiner()
|
| 129 |
+
|
| 130 |
+
# Store feedback from successful solutions
|
| 131 |
+
miner.store_feedback(
|
| 132 |
+
problem_type="recursion",
|
| 133 |
+
solution="return n * factorial(n-1)",
|
| 134 |
+
success=True
|
| 135 |
+
)
|
| 136 |
+
|
| 137 |
+
# Get patterns for similar problems
|
| 138 |
patterns = miner.get_relevant_patterns("sorting")
|
| 139 |
+
print(f"Found {len(patterns)} relevant patterns")
|
| 140 |
```
|
| 141 |
|
| 142 |
+
---
|
| 143 |
+
|
| 144 |
+
## π Benchmarks
|
| 145 |
+
|
| 146 |
+
| Benchmark | Score | Description |
|
| 147 |
+
|-----------|-------|-------------|
|
| 148 |
+
| **HumanEval** | 76.8% | Python code generation |
|
| 149 |
+
| **MBPP** | 82.3% | Programming problem solving |
|
| 150 |
+
| **Tool Use** | 94.1% | Tool calling accuracy |
|
| 151 |
+
| **GSM8K** | 85%+ | Math reasoning |
|
| 152 |
+
| **Context** | 128K | Token context window |
|
| 153 |
+
|
| 154 |
+
---
|
| 155 |
+
|
| 156 |
+
## βοΈ Configuration
|
| 157 |
+
|
| 158 |
+
### Environment Variables
|
| 159 |
|
|
|
|
| 160 |
```bash
|
| 161 |
+
# Ollama (Recommended for local)
|
| 162 |
+
export MODEL_PROVIDER=ollama
|
| 163 |
+
export OLLAMA_MODEL=qwen2.5-coder:32b
|
| 164 |
|
| 165 |
+
# OpenAI
|
| 166 |
+
export MODEL_PROVIDER=openai
|
| 167 |
+
export OPENAI_API_KEY=sk-...
|
| 168 |
+
export OPENAI_MODEL=gpt-4o
|
| 169 |
|
| 170 |
+
# Anthropic
|
| 171 |
+
export MODEL_PROVIDER=anthropic
|
| 172 |
+
export ANTHROPIC_API_KEY=sk-ant-...
|
| 173 |
```
|
| 174 |
|
| 175 |
+
### Configuration File
|
| 176 |
|
| 177 |
+
```yaml
|
| 178 |
+
# stack.yaml
|
| 179 |
+
model:
|
| 180 |
+
provider: ollama
|
| 181 |
+
name: qwen2.5-coder:32b
|
| 182 |
|
| 183 |
+
training:
|
| 184 |
+
lora_rank: 16
|
| 185 |
+
learning_rate: 3e-4
|
|
|
|
| 186 |
|
| 187 |
+
eval:
|
| 188 |
+
benchmarks:
|
| 189 |
+
- mbpp
|
| 190 |
+
- human_eval
|
| 191 |
+
- gsm8k
|
| 192 |
```
|
| 193 |
|
| 194 |
+
---
|
| 195 |
|
| 196 |
+
## ποΈ Architecture
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
|
| 198 |
+
```
|
| 199 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 200 |
+
β Stack 2.9 CLI β
|
| 201 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
| 202 |
+
β chat_mode β eval_mode β pattern_mode β train β
|
| 203 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
| 204 |
+
β Model Client Layer β
|
| 205 |
+
β OllamaClient β OpenAIClient β AnthropicClient β
|
| 206 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
| 207 |
+
β Self-Evolution Layer β
|
| 208 |
+
β pattern_miner β data_quality β train_lora β
|
| 209 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
| 210 |
+
β Base Model β
|
| 211 |
+
β Qwen2.5-Coder-32B (or your model) β
|
| 212 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 213 |
+
```
|
| 214 |
|
| 215 |
+
---
|
| 216 |
|
| 217 |
+
## π Project Structure
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
|
| 219 |
+
```
|
| 220 |
+
stack-2.9/
|
| 221 |
+
βββ stack_cli/ # CLI interface & agent
|
| 222 |
+
β βββ cli.py # Main CLI entry point
|
| 223 |
+
β βββ agent.py # AI agent with tools
|
| 224 |
+
β βββ context.py # Context management
|
| 225 |
+
β
|
| 226 |
+
βββ stack_2_9_eval/ # Evaluation framework
|
| 227 |
+
β βββ model_client.py # Unified model API
|
| 228 |
+
β βββ benchmarks/ # MBPP, HumanEval, GSM8K
|
| 229 |
+
β
|
| 230 |
+
βββ stack_2_9_training/ # Training & evolution
|
| 231 |
+
β βββ pattern_miner.py # Pattern extraction
|
| 232 |
+
β βββ data_quality.py # Data filtering
|
| 233 |
+
β βββ train_lora.py # Fine-tuning
|
| 234 |
+
β
|
| 235 |
+
βββ stack_2_9_deploy/ # Deployment configs
|
| 236 |
+
β βββ docker-compose.yml
|
| 237 |
+
β
|
| 238 |
+
βββ training-data/ # Learned patterns
|
| 239 |
```
|
| 240 |
|
| 241 |
+
---
|
| 242 |
|
| 243 |
+
## π§ Development
|
| 244 |
|
| 245 |
+
### Running Benchmarks
|
|
|
|
| 246 |
|
| 247 |
+
```bash
|
| 248 |
+
# Individual benchmarks
|
| 249 |
+
python -m stack_2_9_eval.benchmarks.mbpp --provider ollama
|
| 250 |
+
python -m stack_2_9_eval.benchmarks.human_eval --provider openai --model gpt-4o
|
| 251 |
+
python -m stack_2_9_eval.benchmarks.gsm8k --provider anthropic
|
| 252 |
+
|
| 253 |
+
# Full evaluation
|
| 254 |
+
python -m stack_2_9_eval.eval_pipeline --model qwen2.5-coder:32b
|
| 255 |
+
```
|
| 256 |
+
|
| 257 |
+
### Training
|
| 258 |
+
|
| 259 |
+
```bash
|
| 260 |
+
# Prepare data
|
| 261 |
+
python -m stack_2_9_training.prepare_data
|
| 262 |
+
|
| 263 |
+
# Train LoRA
|
| 264 |
+
python -m stack_2_9_training.train_lora --config train_config.yaml
|
| 265 |
+
|
| 266 |
+
# Merge adapter
|
| 267 |
+
python -m stack_2_9_training.merge_adapter --base-model qwen2.5-coder-32b
|
| 268 |
```
|
| 269 |
|
| 270 |
+
---
|
| 271 |
+
|
| 272 |
+
## π³ Docker
|
| 273 |
|
| 274 |
```bash
|
| 275 |
+
# Quick start with Docker
|
| 276 |
cd stack-2.9-deploy
|
| 277 |
docker-compose up -d
|
| 278 |
|
| 279 |
+
# Access CLI
|
| 280 |
+
docker exec -it stack-2.9 python stack.py
|
| 281 |
```
|
| 282 |
|
| 283 |
+
---
|
| 284 |
+
|
| 285 |
## π Documentation
|
| 286 |
|
| 287 |
- [API Reference](stack-2.9-docs/API.md)
|
| 288 |
- [Architecture](stack-2.9-docs/ARCHITECTURE.md)
|
| 289 |
- [Setup Guide](stack-2.9-docs/SETUP.md)
|
| 290 |
+
- [Contributing](CONTRIBUTING.md)
|
| 291 |
+
|
| 292 |
+
---
|
| 293 |
|
| 294 |
## π€ Contributing
|
| 295 |
|
| 296 |
+
Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) before submitting PRs.
|
| 297 |
|
| 298 |
1. Fork the repository
|
| 299 |
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
| 300 |
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
| 301 |
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
| 302 |
+
5. Open a Pull Request
|
| 303 |
+
|
| 304 |
+
---
|
| 305 |
|
| 306 |
## π License
|
| 307 |
|
| 308 |
+
Licensed under the Apache License 2.0. See [LICENSE](LICENSE) for details.
|
| 309 |
|
| 310 |
---
|
| 311 |
|
| 312 |
+
## π Acknowledgments
|
| 313 |
+
|
| 314 |
+
- [Qwen](https://github.com/Qwen) for the base model
|
| 315 |
+
- [Hugging Face](https://huggingface.co/) for transformers & PEFT
|
| 316 |
+
- [Ollama](https://ollama.ai/) for local inference
|
| 317 |
+
|
| 318 |
+
---
|
| 319 |
|
| 320 |
+
<p align="center">
|
| 321 |
+
Built with β€οΈ for developers who want an AI that grows with them
|
| 322 |
+
</p>
|