Compare commits

..

2 Commits

Author SHA1 Message Date
ViperEkura 9cbc7b0878 switch to Qwen3-VL-8B-Instruct, fix start.sh arg, enable tool calling with hermes parser 2026-06-15 14:01:04 +08:00
ViperEkura 917ff1c357 refactor server.py to use vLLM Python API and add permission config
server.py: switch from os.execvp(vllm) to make_arg_parser + asyncio.run(run_server(args)) for better error handling; add GPU selection via CLI argument
opencode.json: add default model field and permission.question=ask to prevent auto-triggering question tool
2026-06-14 20:51:00 +08:00
2 changed files with 31 additions and 13 deletions

View File

@ -1,5 +1,6 @@
{
"$schema": "https://opencode.ai/config.json",
"model": "Agent/Qwen3-VL-8B-Instruct",
"provider": {
"Agent": {
"api": "openai",
@ -8,15 +9,18 @@
"apiKey": "not-needed"
},
"models": {
"Qwen2.5-7B-Instruct": {
"id": "Qwen2.5-7B-Instruct",
"name": "Qwen2.5-7B-Instruct",
"Qwen3-VL-8B-Instruct": {
"id": "Qwen3-VL-8B-Instruct",
"name": "Qwen3-VL-8B-Instruct",
"limit": { "context": 32768, "output": 8192 },
"cost": { "input": 0, "output": 0 }
}
}
}
},
"permission": {
"question": "ask"
},
"experimental": {
"mcp_timeout": 60000
}

View File

@ -1,10 +1,18 @@
import os, subprocess
import os, sys
import asyncio
import subprocess
from pathlib import Path
from vllm.utils.argparse_utils import FlexibleArgumentParser
from vllm.entrypoints.openai.api_server import run_server
from vllm.entrypoints.openai.cli_args import make_arg_parser
def _pick_free_gpu():
if "CUDA_VISIBLE_DEVICES" in os.environ:
return os.environ["CUDA_VISIBLE_DEVICES"]
try:
out = subprocess.check_output(
["nvidia-smi", "--query-gpu=index,memory.free", "--format=csv,noheader"],
text=True,
@ -14,27 +22,33 @@ def _pick_free_gpu():
gpu = best.split(",")[0].strip()
except Exception:
gpu = "0"
os.environ["CUDA_VISIBLE_DEVICES"] = gpu
return gpu
if __name__ == "__main__":
_pick_free_gpu()
model = str(Path(__file__).resolve().parent / "models/Qwen2.5-7B-Instruct")
gpu = _pick_free_gpu()
if len(sys.argv) > 1:
gpu = sys.argv[1]
os.environ["CUDA_VISIBLE_DEVICES"] = gpu
os.environ["FLASHINFER_DISABLE_VERSION_CHECK"] = "1"
os.execvp("vllm", [
"vllm", "serve",
model,
model = str(Path(__file__).resolve().parent / "models/Qwen3-VL-8B-Instruct")
parser = make_arg_parser(FlexibleArgumentParser())
args = parser.parse_args([
"--model", model,
"--host", "0.0.0.0",
"--port", "8000",
"--served-model-name", "Qwen2.5-7B-Instruct",
"--served-model-name", "Qwen3-VL-8B-Instruct",
"--trust-remote-code",
"--max-model-len", "32768",
"--dtype", "bfloat16",
"--gpu-memory-utilization", "0.85",
"--gpu-memory-utilization", "0.70",
"--enforce-eager",
"--enable-auto-tool-choice",
"--tool-call-parser", "hermes",
])
asyncio.run(run_server(args))