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
File size: 7,079 Bytes
3de42e7 | 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 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | #!/usr/bin/env python3
"""Async Tool Audit for Stack 2.9 - Tests all tools properly with async execution"""
import sys
import asyncio
import time
from datetime import datetime
sys.path.insert(0, '/Users/walidsobhi/stack-2.9/src')
# Import tools to trigger registration
import tools
def print_header(title):
print("\n" + "=" * 60)
print(f" {title}")
print("=" * 60)
async def test_tool(tool, name, test_input):
"""Test a single tool with async execution"""
start_time = time.time()
try:
if asyncio.iscoroutinefunction(tool.execute):
result = await tool.execute(**test_input)
else:
result = tool.execute(**test_input)
duration = time.time() - start_time
# Check result
if hasattr(result, 'success'):
if result.success:
return {
"status": "PASS",
"duration": duration,
"data": result.data if result.data else "OK"
}
else:
return {
"status": "FAIL",
"duration": duration,
"error": result.error
}
else:
return {
"status": "PASS",
"duration": duration,
"data": str(result)
}
except Exception as e:
duration = time.time() - start_time
return {
"status": "FAIL",
"duration": duration,
"error": str(e)
}
async def audit_all_tools():
"""Run async audit on all tools"""
print_header("STACK 2.9 ASYNC TOOL AUDIT")
print(f"Started: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
from tools import tool_registry
all_tools = tool_registry.list()
print(f"\nFound {len(all_tools)} registered tools")
# Define test cases for each tool
test_cases = {
"file_read": {"path": "/Users/walidsobhi/stack-2.9/README.md"},
"file_exists": {"path": "/Users/walidsobhi/stack-2.9/README.md"},
"file_write": {"path": "/tmp/test_tool_audit.txt", "content": "test content"},
"file_delete": {"path": "/tmp/test_tool_audit.txt"},
"glob": {"pattern": "*.py", "path": "/Users/walidsobhi/stack-2.9/src"},
"grep": {"pattern": "def ", "path": "/Users/walidsobhi/stack-2.9/src/tools"},
"grep_count": {"pattern": "def ", "path": "/Users/walidsobhi/stack-2.9/src/tools"},
"WebSearch": {"query": "python async", "num_results": 3},
"web_fetch": {"url": "https://example.com"},
"tool_search": {"query": "file"},
"tool_list_all": {},
"tool_info": {"name": "file_read"},
"tool_capabilities": {},
"TaskCreate": {"subject": "Test Task", "description": "Test description"},
"TaskList": {},
"TaskUpdate": {"taskId": "1", "status": "completed"},
"TaskDelete": {"taskId": "1"},
"TodoWrite": {"subject": "Test Todo"},
"team_create": {"name": "test-team"},
"team_list": {},
"team_status": {"team_id": "test-team"},
"team_assign": {"team_id": "test-team", "user_id": "test-user"},
"team_delete": {"team_id": "test-team"},
"team_leave": {"team_id": "test-team"},
"team_disband": {"team_id": "test-team"},
"skill_list": {},
"skill_search": {"query": "code"},
"skill_info": {"name": "python"},
"skill_execute": {"name": "python", "args": "print('hello')"},
"skill_chain": {"skills": ["python"]},
"brief": {"content": "This is a test content for brief analysis."},
"brief_summary": {"content": "This is a test content."},
"sleep": {"seconds": 0.1},
"wait_for": {"condition": "true", "timeout": 1},
"synthetic_output": {"template": "Test output: {value}", "values": {"value": "hello"}},
"structure_data": {"data": {"name": "test"}, "format": "json"},
"agent_spawn": {"name": "test-agent", "capabilities": ["code"]},
"agent_list": {},
"agent_status": {"name": "test-agent"},
"ask_question": {"question": "Test question?"},
"get_pending_questions": {},
"answer_question": {"question_id": "1", "answer": "Test answer"},
"message_send": {"channel": "test", "content": "Test message"},
"message_list": {"channel": "test"},
"message_channel": {"action": "create", "name": "test-channel"},
"message_template": {"name": "test", "variables": {}},
"CronCreate": {"expression": "* * * * *", "command": "echo test"},
"CronList": {},
"CronDelete": {"id": "test-cron"},
"mcp_list_servers": {},
"mcp_add_server": {"name": "test", "command": "echo test"},
"mcp_call": {"server": "test", "tool_name": "test", "args": {}},
"read_mcp_resource": {"resource_uri": "test://resource"},
"remote_add": {"name": "test", "url": "https://example.com"},
"remote_list": {},
"remote_remove": {"name": "test"},
"remote_trigger": {"name": "test", "action": "test"},
"EnterPlanMode": {},
"ExitPlanMode": {},
"enter_worktree": {"path": "/tmp/test-worktree"},
"exit_worktree": {},
"list_worktrees": {},
"Config": {"operation": "get", "key": "test"},
}
results = {}
passed = 0
failed = 0
print("\n" + "-" * 60)
print("Testing tools...")
print("-" * 60)
for name in all_tools:
tool = tool_registry.get(name)
if not tool:
results[name] = {"status": "FAIL", "error": "Tool not found"}
failed += 1
continue
# Get test input or empty dict
test_input = test_cases.get(name, {})
# Skip tools without test cases
if not test_input:
results[name] = {"status": "SKIP", "error": "No test case"}
continue
result = await test_tool(tool, name, test_input)
results[name] = result
status = result["status"]
if status == "PASS":
passed += 1
print(f"✓ {name}: PASS ({result['duration']:.3f}s)")
elif status == "SKIP":
print(f"○ {name}: SKIP")
passed += 1 # Count skipped as OK
else:
failed += 1
print(f"✗ {name}: FAIL ({result['duration']:.3f}s)")
print(f" Error: {result.get('error', 'Unknown')}")
# Summary
print_header("AUDIT SUMMARY")
total = len(all_tools)
print(f"""
Total Tools: {total}
Passed: {passed}
Failed: {failed}
Success Rate: {(passed/total)*100:.1f}%
""")
# Show failures
if failed > 0:
print_header("FAILURES")
for name, result in results.items():
if result["status"] == "FAIL":
print(f" • {name}: {result.get('error', 'Unknown error')}")
print(f"\nCompleted: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
return results
if __name__ == "__main__":
asyncio.run(audit_all_tools()) |