Phase 01 (LLM Tuning): - Gemma4 26B: 74.65 t/s (fast) - Qwen 35B: 61.62 t/s (balanced) - Gemma4 31B: 16.0 t/s (deep-coder) - Qwen 27B: 16.7 t/s (deep-logic) - Qwen 122B: 8.95 t/s (ultra, GPU 1 only) Phase 02 (API Engine): - FastAPI reverse proxy on port 8000 - /engine/switch hot-swap with 503 protection - config/engine_models.json as single source of truth - Replaced 4 individual .bat files with unified engine File cleanup: - scripts/ 85 files -> 9 + _archive/ - Root .bat files -> _archive/
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
import urllib.request, json, time, sys
|
|
try: sys.stdout.reconfigure(encoding='utf-8')
|
|
except: pass
|
|
|
|
BASE = "http://127.0.0.1:8000"
|
|
prompt = "Write a Python function to calculate fibonacci numbers efficiently using memoization. Include type hints and docstring."
|
|
|
|
payload = json.dumps({
|
|
"model": "m",
|
|
"messages": [
|
|
{"role": "system", "content": "You are a helpful assistant."},
|
|
{"role": "user", "content": prompt}
|
|
],
|
|
"max_tokens": 500,
|
|
"temperature": 0.0
|
|
}).encode('utf-8')
|
|
|
|
req = urllib.request.Request(
|
|
f"{BASE}/v1/chat/completions",
|
|
data=payload,
|
|
headers={"Content-Type": "application/json"}
|
|
)
|
|
|
|
print("Sending request...")
|
|
t0 = time.time()
|
|
resp = json.loads(urllib.request.urlopen(req, timeout=300).read())
|
|
dt = time.time() - t0
|
|
|
|
u = resp.get("usage", {})
|
|
tokens = u.get("completion_tokens", 0)
|
|
speed = tokens / dt if dt > 0 else 0
|
|
|
|
print(f"\n=== 122B Benchmark ===")
|
|
print(f"Time: {dt:.1f}s")
|
|
print(f"Completion Tokens: {tokens}")
|
|
print(f"Speed: {speed:.2f} t/s")
|
|
print(f"\n--- Response Preview ---")
|
|
print(resp["choices"][0]["message"]["content"][:300])
|