Skip to content

Commit 6d6ac4d

Browse files
authored
Merge pull request #142 from thushan/feature/backend/lmdeploy
backend; LM Deploy
2 parents d314e58 + 19b712b commit 6d6ac4d

23 files changed

Lines changed: 1477 additions & 7 deletions

File tree

config/profiles/lmdeploy.yaml

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# LMDeploy inference platform profile
2+
name: lmdeploy
3+
home: "https://github.com/InternLM/lmdeploy"
4+
version: "1.0"
5+
display_name: "LMDeploy"
6+
description: "LMDeploy efficient inference and serving for LLMs and VLMs"
7+
8+
# Routing configuration
9+
routing:
10+
prefixes:
11+
- lmdeploy
12+
13+
# API compatibility
14+
api:
15+
openai_compatible: true
16+
paths:
17+
# Health and system endpoints
18+
- /health # 0: health check (HTTP 200, empty body)
19+
20+
# Model management
21+
- /v1/models # 1: list models (OpenAI-compatible ModelList)
22+
23+
# Text generation endpoints (OpenAI-compatible)
24+
- /v1/chat/completions # 2: chat completions with SSE streaming
25+
- /v1/completions # 3: text completions
26+
27+
# LMDeploy-specific endpoints
28+
- /v1/encode # 4: token encoding (LMDeploy-specific)
29+
- /generate # 5: native generation endpoint
30+
- /pooling # 6: reward/score pooling (the real embeddings path)
31+
# NOTE: /v1/embeddings is intentionally excluded — LMDeploy returns HTTP 400
32+
# unconditionally for all backends on that path.
33+
34+
# Sleep state probe (LMDeploy-specific, used for auto-detection)
35+
- /is_sleeping # 7: sleep state probe
36+
37+
model_discovery_path: /v1/models
38+
health_check_path: /health
39+
40+
# Platform characteristics
41+
characteristics:
42+
timeout: 2m
43+
max_concurrent_requests: 100
44+
default_priority: 82 # between SGLang (85) and vLLM (80)
45+
streaming_support: true
46+
47+
# Detection hints for auto-discovery
48+
detection:
49+
path_indicators:
50+
- "/v1/encode" # LMDeploy-specific token encoding
51+
- "/generate" # LMDeploy native generation
52+
- "/pooling" # LMDeploy reward/score path
53+
- "/is_sleeping" # distinct from vLLM and SGLang
54+
default_ports:
55+
- 23333 # api_server default (not 8000 which is proxy_server)
56+
57+
# Request/response handling
58+
request:
59+
model_field_paths:
60+
- "model"
61+
response_format: "lmdeploy"
62+
parsing_rules:
63+
chat_completions_path: "/v1/chat/completions"
64+
completions_path: "/v1/completions"
65+
model_field_name: "model"
66+
supports_streaming: true
67+
68+
# Path indices for specific functions
69+
path_indices:
70+
health: 0
71+
models: 1
72+
chat_completions: 2
73+
completions: 3
74+
75+
# Model handling
76+
models:
77+
name_format: "{{.Name}}"
78+
capability_patterns:
79+
chat:
80+
- "*-Chat-*"
81+
- "*-Instruct*"
82+
- "*-chat-*"
83+
vision:
84+
- "*vision*"
85+
- "*llava*"
86+
- "*VL*"
87+
code:
88+
- "*code*"
89+
- "*Code*"
90+
# Context window patterns for common LMDeploy models
91+
context_patterns:
92+
- pattern: "*llama-3.1*"
93+
context: 131072
94+
- pattern: "*llama-3*"
95+
context: 8192
96+
- pattern: "*internlm2_5*"
97+
context: 32768
98+
- pattern: "*internlm2*"
99+
context: 32768
100+
- pattern: "*mistral*"
101+
context: 32768
102+
- pattern: "*qwen2*"
103+
context: 32768
104+
105+
# Resource management
106+
resources:
107+
model_sizes:
108+
- patterns: ["*70b*", "*72b*"]
109+
min_memory_gb: 140
110+
recommended_memory_gb: 160
111+
min_gpu_memory_gb: 140
112+
estimated_load_time_ms: 60000
113+
- patterns: ["*34b*", "*33b*", "*30b*"]
114+
min_memory_gb: 70
115+
recommended_memory_gb: 80
116+
min_gpu_memory_gb: 70
117+
estimated_load_time_ms: 45000
118+
- patterns: ["*13b*", "*14b*"]
119+
min_memory_gb: 30
120+
recommended_memory_gb: 40
121+
min_gpu_memory_gb: 30
122+
estimated_load_time_ms: 30000
123+
- patterns: ["*7b*", "*8b*"]
124+
min_memory_gb: 16
125+
recommended_memory_gb: 24
126+
min_gpu_memory_gb: 16
127+
estimated_load_time_ms: 20000
128+
- patterns: ["*3b*"]
129+
min_memory_gb: 8
130+
recommended_memory_gb: 12
131+
min_gpu_memory_gb: 8
132+
estimated_load_time_ms: 15000
133+
- patterns: ["*1b*", "*1.1b*", "*1.5b*"]
134+
min_memory_gb: 4
135+
recommended_memory_gb: 8
136+
min_gpu_memory_gb: 4
137+
estimated_load_time_ms: 10000
138+
139+
defaults:
140+
min_memory_gb: 8
141+
recommended_memory_gb: 16
142+
min_gpu_memory_gb: 8
143+
requires_gpu: true
144+
estimated_load_time_ms: 30000
145+
146+
concurrency_limits:
147+
- min_memory_gb: 100
148+
max_concurrent: 10
149+
- min_memory_gb: 50
150+
max_concurrent: 20
151+
- min_memory_gb: 20
152+
max_concurrent: 50
153+
- min_memory_gb: 0
154+
max_concurrent: 100
155+
156+
timeout_scaling:
157+
base_timeout_seconds: 120
158+
load_time_buffer: true
159+
160+
# Metrics extraction for LMDeploy responses
161+
metrics:
162+
extraction:
163+
enabled: true
164+
source: response_body
165+
format: json
166+
paths:
167+
model: "$.model"
168+
finish_reason: "$.choices[0].finish_reason"
169+
input_tokens: "$.usage.prompt_tokens"
170+
output_tokens: "$.usage.completion_tokens"
171+
total_tokens: "$.usage.total_tokens"
172+
calculations:
173+
is_complete: 'len(finish_reason) > 0'

0 commit comments

Comments
 (0)