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
| #!/usr/bin/env python3 | |
| """ | |
| Stack 2.9 Demo Script | |
| Showcases the capabilities of the Stack 2.9 CLI and Agent Interface. | |
| """ | |
| import os | |
| import sys | |
| from pathlib import Path | |
| # Add stack_cli to path | |
| sys.path.insert(0, str(Path(__file__).parent / "stack_cli")) | |
| from stack_cli.agent import create_agent | |
| from stack_cli.tools import list_tools | |
| from stack_cli.context import create_context_manager | |
| def print_section(title: str): | |
| """Print a section header.""" | |
| print("\n" + "="*60) | |
| print(f" {title}") | |
| print("="*60) | |
| def demo(): | |
| """Run the demo.""" | |
| print_banner() | |
| # Initialize | |
| print("\n➤ Initializing Stack 2.9 Agent...") | |
| agent = create_agent() | |
| print(f" ✓ Agent loaded with {len(list_tools())} tools") | |
| # Show context | |
| print_section("Workspace Context") | |
| ctx = agent.get_context() | |
| print(ctx) | |
| # Show available tools | |
| print_section("Available Tools") | |
| tools = list_tools() | |
| print(f"\nTotal tools: {len(tools)}\n") | |
| categories = { | |
| "File Operations": ["read", "write", "edit", "search", "grep", "copy", "move", "delete"], | |
| "Git Operations": ["git_status", "git_commit", "git_push", "git_pull", "git_branch", "git_log", "git_diff"], | |
| "Code Execution": ["run", "test", "lint", "format", "typecheck", "server", "install"], | |
| "Web Tools": ["web_search", "fetch", "download", "check_url", "screenshot"], | |
| "Memory & Context": ["memory_recall", "memory_save", "memory_list", "context_load", "project_scan"], | |
| "Task Planning": ["create_task", "list_tasks", "update_task", "delete_task", "create_plan", "execute_plan"] | |
| } | |
| for category, tool_list in categories.items(): | |
| print(f"\n{category} ({len(tool_list)}):") | |
| for tool in tool_list: | |
| if tool in tools: | |
| print(f" ✓ {tool}") | |
| # Demo: Run a sample query | |
| print_section("Demo: Sample Query") | |
| print("\nQuery: \"list my tasks\"") | |
| response = agent.process("list my tasks") | |
| print(f"\nResponse:\n {response.content}") | |
| print_section("Demo: Project Scan") | |
| print("\nQuery: \"scan project structure\"") | |
| response = agent.process("scan project structure") | |
| print(f"\nResponse:\n {response.content[:500]}...") | |
| print_section("Agent Capabilities") | |
| print(""" | |
| The Stack 2.9 Agent can: | |
| • Understand natural language queries | |
| • Select appropriate tools automatically | |
| • Generate helpful responses | |
| • Self-reflect and improve | |
| • Maintain conversation context | |
| • Execute complex workflows | |
| """) | |
| print_section("Quick Start") | |
| print(""" | |
| To use Stack 2.9 CLI: | |
| 1. Interactive Chat: | |
| $ python -m stack_cli.cli | |
| or | |
| $ stack | |
| 2. Single Command: | |
| $ python -m stack_cli.cli -c "read README.md" | |
| or | |
| $ stack -c "git status" | |
| 3. Specific Tools: | |
| $ stack -t project_scan list_tasks | |
| 4. Voice Mode (requires setup): | |
| $ stack -v | |
| 5. Python API: | |
| from stack_cli import create_agent | |
| agent = create_agent() | |
| response = agent.process("list files") | |
| print(response.content) | |
| """) | |
| print_section("Demo Complete!") | |
| print("\nThe Stack 2.9 CLI and Agent Interface is ready to use.") | |
| print("Run 'python stack.py' or 'stack' to start.\n") | |
| def print_banner(): | |
| """Print the banner.""" | |
| banner = r""" | |
| ____ _ _ _ | |
| | _ \ ___ _ __ __| |_ __ ___ (_)_ __ | | __ | |
| | |_) / _ \ '_ \ / _` | '__/ _ \| | '_ \ | |/ / | |
| | _ < __/ | | | (_| | | | (_) | | | | | | < | |
| |_| \_\___|_| |_|\__,_|_| \___/|_|_| |_| |_|\_\ | |
| CLI & Agent Interface v2.9.0 | |
| """ | |
| print(banner) | |
| if __name__ == "__main__": | |
| demo() | |