OpenLLM 模型服务化
OpenLLM 用一条命令把开源大模型包装成 OpenAI 兼容 API,支持 vLLM、Transformers 等后端、LoRA adapter 和 Kubernetes 部署。适合快速验证和内部服务。
核心命令:openllm serve、openllm build、openllm chat。
安装:
pip install openllm
启动服务:
openllm serve qwen2.5:7b-instruct \
--backend vllm \
--port 3000
调用:
curl http://localhost:3000/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{"model":"qwen2.5:7b-instruct","messages":[{"role":"user","content":"你好"}]}'
加载 LoRA adapter:
openllm serve qwen2.5:7b-instruct \
--adapter-id my-org/qwen-lora
构建容器镜像:
openllm build qwen2.5:7b-instruct --containerize