File size: 3,242 Bytes
99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 2088481 99a7be2 2088481 99a7be2 2088481 99a7be2 2088481 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 b6ae7b8 99a7be2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | # π Stack 2.9 - Pattern-Based AI Coding Assistant
A HuggingFace Spaces demo for Stack 2.9, a pattern-based AI coding assistant powered by Qwen2.5-Coder-7B.



## β¨ Features
- **π€ Qwen2.5-Coder-7B** - State-of-the-art code generation model
- **π§ 7 Integrated Tools** - File operations, git, web search, shell commands
- **π§ Pattern Memory** - Learns from each interaction
- **β‘ Fast Streaming** - Real-time token-by-token generation
- **πΎ 4-bit Quantization** - Runs on 16GB GPU (~4GB VRAM)
## π§ Available Tools
| Tool | Description |
|------|-------------|
| `file_read` | Read files from the filesystem |
| `file_write` | Write content to files |
| `git_status` | Check git repository status |
| `web_search` | Search the web for information |
| `run_command` | Execute shell commands |
| `create_directory` | Create new directories |
| `list_directory` | List directory contents |
## πββοΈ Quick Start
### Local Development
```bash
# Clone the repository
git clone https://github.com/your-repo/stack-2.9.git
cd stack-2.9/space
# Install dependencies
pip install -r requirements.txt
# Run the demo
python app.py --share
```
### HuggingFace Spaces
1. Create a new Space on [HuggingFace](https://huggingface.co/spaces)
2. Select "Gradio" as the SDK
3. Upload the files from this directory:
- `app.py`
- `requirements.txt`
- `README.md`
4. The model will load automatically on startup
## π» Usage
### Example Prompts
```
Hello! What can you help me with?
Check git status of this repository
Search for best practices for Python async programming
List the files in the current directory
Write a simple Python function to calculate fibonacci
How do I use Git to create a new branch?
What's your memory of our conversation?
```
### Python API
```python
from app import StackModel, memory
# Initialize model
model = StackModel()
model.load()
# Generate response
response = model.generate("Write a hello world in Python")
print(response)
# Check memory stats
print(memory.get_stats())
```
## π Environment Variables
- `HF_TOKEN` - Your HuggingFace token for private models (optional)
- `MODEL_ID` - Override default model (default: Qwen/Qwen2.5-Coder-7B-Instruct)
## π Memory System
Stack 2.9 includes a pattern memory system that:
1. **Tracks Interactions** - Records every user-assistant exchange
2. **Learns Patterns** - Identifies frequently used tools
3. **Stores Code** - Saves useful code snippets
4. **Adapts Behavior** - Uses learned context to improve responses
## π οΈ Tech Stack
- **Model**: Qwen2.5-Coder-7B-Instruct
- **Quantization**: 4-bit (bitsandbytes)
- **Framework**: Gradio 4.0+
- **Backend**: Transformers + Accelerate
- **GPU**: 16GB VRAM recommended
## π License
MIT License - see LICENSE file for details.
## π Acknowledgments
- [Qwen](https://github.com/QwenLM/Qwen) - Base model
- [HuggingFace](https://huggingface.co/) - Spaces hosting
- [Gradio](https://gradio.app/) - UI framework
---
<div align="center">
Made with β€οΈ by Stack 2.9
</div> |