sglang 0.2.6__py3-none-any.whl → 0.2.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sglang/__init__.py +33 -26
- sglang/api.py +9 -1
- sglang/bench_latency.py +2 -2
- sglang/bench_serving.py +10 -1
- sglang/check_env.py +1 -1
- sglang/lang/backend/litellm.py +1 -1
- sglang/lang/backend/openai.py +1 -1
- sglang/lang/interpreter.py +20 -5
- sglang/lang/ir.py +1 -1
- sglang/srt/constrained/__init__.py +15 -0
- sglang/srt/constrained/base_cache.py +15 -0
- sglang/srt/constrained/fsm_cache.py +15 -0
- sglang/srt/constrained/jump_forward.py +15 -0
- sglang/srt/conversation.py +26 -0
- sglang/srt/hf_transformers_utils.py +15 -0
- sglang/srt/layers/context_flashattention_nopad.py +15 -0
- sglang/srt/layers/extend_attention.py +15 -0
- sglang/srt/layers/fused_moe.py +15 -0
- sglang/srt/layers/linear.py +15 -0
- sglang/srt/layers/logits_processor.py +41 -13
- sglang/srt/layers/quantization/__init__.py +15 -0
- sglang/srt/layers/quantization/fp8.py +15 -0
- sglang/srt/layers/radix_attention.py +17 -2
- sglang/srt/layers/token_attention.py +16 -1
- sglang/srt/managers/{controller/manager_multi.py → controller_multi.py} +17 -2
- sglang/srt/managers/{controller/manager_single.py → controller_single.py} +17 -2
- sglang/srt/managers/detokenizer_manager.py +16 -1
- sglang/srt/managers/io_struct.py +36 -3
- sglang/srt/managers/{controller/schedule_heuristic.py → policy_scheduler.py} +37 -22
- sglang/srt/managers/{controller/infer_batch.py → schedule_batch.py} +31 -12
- sglang/srt/managers/tokenizer_manager.py +39 -16
- sglang/srt/managers/{controller/tp_worker.py → tp_worker.py} +130 -40
- sglang/srt/mem_cache/flush_cache.py +33 -0
- sglang/srt/{memory_pool.py → mem_cache/memory_pool.py} +16 -1
- sglang/srt/{managers/controller → mem_cache}/radix_cache.py +15 -0
- sglang/srt/mm_utils.py +15 -0
- sglang/srt/model_config.py +15 -0
- sglang/srt/{managers/controller → model_executor}/cuda_graph_runner.py +16 -1
- sglang/srt/{managers/controller → model_executor}/model_runner.py +32 -12
- sglang/srt/model_loader/model_loader.py +15 -0
- sglang/srt/model_loader/utils.py +16 -1
- sglang/srt/models/chatglm.py +16 -1
- sglang/srt/models/commandr.py +16 -1
- sglang/srt/models/dbrx.py +16 -1
- sglang/srt/models/deepseek.py +16 -1
- sglang/srt/models/deepseek_v2.py +16 -1
- sglang/srt/models/gemma.py +16 -1
- sglang/srt/models/gemma2.py +16 -1
- sglang/srt/models/gpt_bigcode.py +16 -1
- sglang/srt/models/grok.py +16 -1
- sglang/srt/models/internlm2.py +16 -1
- sglang/srt/models/llama2.py +16 -1
- sglang/srt/models/llama_classification.py +16 -1
- sglang/srt/models/llava.py +17 -2
- sglang/srt/models/llavavid.py +17 -2
- sglang/srt/models/minicpm.py +16 -1
- sglang/srt/models/mistral.py +15 -0
- sglang/srt/models/mixtral.py +16 -1
- sglang/srt/models/mixtral_quant.py +16 -1
- sglang/srt/models/qwen.py +16 -1
- sglang/srt/models/qwen2.py +16 -1
- sglang/srt/models/qwen2_moe.py +16 -1
- sglang/srt/models/stablelm.py +16 -1
- sglang/srt/models/yivl.py +15 -0
- sglang/srt/openai_api/adapter.py +520 -135
- sglang/srt/openai_api/protocol.py +64 -0
- sglang/srt/sampling_params.py +15 -0
- sglang/srt/server.py +89 -23
- sglang/srt/server_args.py +49 -11
- sglang/srt/utils.py +15 -0
- sglang/utils.py +22 -0
- sglang/version.py +1 -1
- {sglang-0.2.6.dist-info → sglang-0.2.7.dist-info}/METADATA +32 -6
- sglang-0.2.7.dist-info/RECORD +93 -0
- {sglang-0.2.6.dist-info → sglang-0.2.7.dist-info}/WHEEL +1 -1
- sglang/srt/flush_cache.py +0 -18
- sglang-0.2.6.dist-info/RECORD +0 -93
- {sglang-0.2.6.dist-info → sglang-0.2.7.dist-info}/LICENSE +0 -0
- {sglang-0.2.6.dist-info → sglang-0.2.7.dist-info}/top_level.txt +0 -0
sglang/srt/models/chatglm.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
# coding=utf-8
|
2
17
|
# Adapted from
|
3
18
|
# https://github.com/THUDM/ChatGLM2-6B
|
@@ -30,7 +45,7 @@ from vllm.transformers_utils.configs import ChatGLMConfig
|
|
30
45
|
|
31
46
|
from sglang.srt.layers.logits_processor import LogitsProcessor
|
32
47
|
from sglang.srt.layers.radix_attention import RadixAttention
|
33
|
-
from sglang.srt.
|
48
|
+
from sglang.srt.model_executor.model_runner import InputMetadata
|
34
49
|
|
35
50
|
LoraConfig = None
|
36
51
|
|
sglang/srt/models/commandr.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
# coding=utf-8
|
2
17
|
# Copyright 2024 Cohere and the HuggingFace Inc. team. All rights reserved.
|
3
18
|
#
|
@@ -49,7 +64,7 @@ from vllm.model_executor.utils import set_weight_attrs
|
|
49
64
|
|
50
65
|
from sglang.srt.layers.logits_processor import LogitsProcessor
|
51
66
|
from sglang.srt.layers.radix_attention import RadixAttention
|
52
|
-
from sglang.srt.
|
67
|
+
from sglang.srt.model_executor.model_runner import InputMetadata
|
53
68
|
|
54
69
|
|
55
70
|
@torch.compile
|
sglang/srt/models/dbrx.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
# Adapted from:
|
2
17
|
# https://github.com/vllm-project/vllm/blob/c7f2cf2b7f67bce5842fedfdba508440fe257375/vllm/model_executor/models/dbrx.py#L1
|
3
18
|
# coding=utf-8
|
@@ -30,7 +45,7 @@ from vllm.transformers_utils.configs.dbrx import DbrxConfig
|
|
30
45
|
|
31
46
|
from sglang.srt.layers.logits_processor import LogitsProcessor
|
32
47
|
from sglang.srt.layers.radix_attention import RadixAttention
|
33
|
-
from sglang.srt.
|
48
|
+
from sglang.srt.model_executor.model_runner import InputMetadata
|
34
49
|
|
35
50
|
|
36
51
|
class DbrxRouter(nn.Module):
|
sglang/srt/models/deepseek.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
# Adapted from:
|
2
17
|
# https://github.com/vllm-project/vllm/blob/14f91fe67c2342f2fe859dc6a5c40810df0e1c61/vllm/model_executor/models/deepseek.py
|
3
18
|
"""Inference-only Deepseek model."""
|
@@ -31,7 +46,7 @@ from vllm.model_executor.model_loader.weight_utils import default_weight_loader
|
|
31
46
|
|
32
47
|
from sglang.srt.layers.logits_processor import LogitsProcessor
|
33
48
|
from sglang.srt.layers.radix_attention import RadixAttention
|
34
|
-
from sglang.srt.managers.
|
49
|
+
from sglang.srt.managers.schedule_batch import InputMetadata
|
35
50
|
|
36
51
|
|
37
52
|
class DeepseekMLP(nn.Module):
|
sglang/srt/models/deepseek_v2.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
# Adapted from:
|
2
17
|
# https://github.com/vllm-project/vllm/blob/fb6af8bc086328ca6659e72d11ffd4309ce4de22/vllm/model_executor/models/deepseek_v2.py
|
3
18
|
"""Inference-only DeepseekV2 model."""
|
@@ -30,7 +45,7 @@ from vllm.model_executor.model_loader.weight_utils import default_weight_loader
|
|
30
45
|
|
31
46
|
from sglang.srt.layers.logits_processor import LogitsProcessor
|
32
47
|
from sglang.srt.layers.radix_attention import RadixAttention
|
33
|
-
from sglang.srt.
|
48
|
+
from sglang.srt.model_executor.model_runner import InputMetadata
|
34
49
|
|
35
50
|
|
36
51
|
class DeepseekV2MLP(nn.Module):
|
sglang/srt/models/gemma.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
# Adapted from:
|
2
17
|
# https://github.com/vllm-project/vllm/blob/c7f2cf2b7f67bce5842fedfdba508440fe257375/vllm/model_executor/models/gemma.py#L1
|
3
18
|
"""Inference-only Gemma model compatible with HuggingFace weights."""
|
@@ -22,7 +37,7 @@ from vllm.model_executor.model_loader.weight_utils import default_weight_loader
|
|
22
37
|
|
23
38
|
from sglang.srt.layers.logits_processor import LogitsProcessor
|
24
39
|
from sglang.srt.layers.radix_attention import RadixAttention
|
25
|
-
from sglang.srt.
|
40
|
+
from sglang.srt.model_executor.model_runner import InputMetadata
|
26
41
|
|
27
42
|
|
28
43
|
class GemmaMLP(nn.Module):
|
sglang/srt/models/gemma2.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
# Adapted from:
|
2
17
|
# https://github.com/vllm-project/vllm/blob/56b325e977435af744f8b3dca7af0ca209663558/vllm/model_executor/models/gemma2.py
|
3
18
|
from typing import Iterable, Optional, Set, Tuple, Union
|
@@ -27,7 +42,7 @@ from vllm.model_executor.sampling_metadata import SamplingMetadata
|
|
27
42
|
|
28
43
|
from sglang.srt.layers.logits_processor import LogitsProcessor
|
29
44
|
from sglang.srt.layers.radix_attention import RadixAttention
|
30
|
-
from sglang.srt.
|
45
|
+
from sglang.srt.model_executor.model_runner import InputMetadata
|
31
46
|
|
32
47
|
|
33
48
|
class GemmaRMSNorm(CustomOp):
|
sglang/srt/models/gpt_bigcode.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
# Adapted from:
|
2
17
|
# https://github.com/vllm-project/vllm/blob/07eb6f19f3b0ee9f7adf6eb689607028aa40bfd5/vllm/model_executor/models/gpt_bigcode.py
|
3
18
|
"""Inference-only GPTBigCode model compatible with HuggingFace weights."""
|
@@ -20,7 +35,7 @@ from vllm.model_executor.model_loader.weight_utils import default_weight_loader
|
|
20
35
|
|
21
36
|
from sglang.srt.layers.logits_processor import LogitsProcessor
|
22
37
|
from sglang.srt.layers.radix_attention import RadixAttention
|
23
|
-
from sglang.srt.managers.
|
38
|
+
from sglang.srt.managers.schedule_batch import InputMetadata
|
24
39
|
|
25
40
|
|
26
41
|
class GPTBigCodeAttention(nn.Module):
|
sglang/srt/models/grok.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
# Adapted from
|
2
17
|
# https://github.com/vllm-project/vllm/blob/c7f2cf2b7f67bce5842fedfdba508440fe257375/vllm/model_executor/models/mixtral.py#L1
|
3
18
|
"""Inference-only Grok1 model."""
|
@@ -37,7 +52,7 @@ from vllm.utils import print_warning_once
|
|
37
52
|
from sglang.srt.layers.fused_moe import fused_moe
|
38
53
|
from sglang.srt.layers.logits_processor import LogitsProcessor
|
39
54
|
from sglang.srt.layers.radix_attention import RadixAttention
|
40
|
-
from sglang.srt.
|
55
|
+
from sglang.srt.model_executor.model_runner import InputMetadata
|
41
56
|
|
42
57
|
use_fused = True
|
43
58
|
|
sglang/srt/models/internlm2.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
# -*- coding: utf-8 -*-
|
2
17
|
# Adapted from https://raw.githubusercontent.com/vllm-project/vllm/7f62077af5159c625fe3ad1c812e6c1a2b93ba3b/vllm/model_executor/models/internlm2.py
|
3
18
|
|
@@ -25,7 +40,7 @@ from vllm.model_executor.model_loader.weight_utils import default_weight_loader
|
|
25
40
|
|
26
41
|
from sglang.srt.layers.logits_processor import LogitsProcessor
|
27
42
|
from sglang.srt.layers.radix_attention import RadixAttention
|
28
|
-
from sglang.srt.
|
43
|
+
from sglang.srt.model_executor.model_runner import InputMetadata
|
29
44
|
|
30
45
|
|
31
46
|
class InternLM2MLP(nn.Module):
|
sglang/srt/models/llama2.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
# Adapted from
|
2
17
|
# https://github.com/vllm-project/vllm/blob/c7f2cf2b7f67bce5842fedfdba508440fe257375/vllm/model_executor/models/llama.py#L1
|
3
18
|
"""Inference-only LLaMA model compatible with HuggingFace weights."""
|
@@ -21,7 +36,7 @@ from vllm.model_executor.model_loader.weight_utils import default_weight_loader
|
|
21
36
|
|
22
37
|
from sglang.srt.layers.logits_processor import LogitsProcessor
|
23
38
|
from sglang.srt.layers.radix_attention import RadixAttention
|
24
|
-
from sglang.srt.
|
39
|
+
from sglang.srt.model_executor.model_runner import InputMetadata
|
25
40
|
|
26
41
|
MergedColumnParallelLinear = None
|
27
42
|
QKVParallelLinear = None
|
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
from typing import Iterable, Optional, Tuple
|
2
17
|
|
3
18
|
import torch
|
@@ -10,7 +25,7 @@ from vllm.model_executor.layers.quantization.base_config import QuantizationConf
|
|
10
25
|
from vllm.model_executor.model_loader.weight_utils import default_weight_loader
|
11
26
|
|
12
27
|
from sglang.srt.layers.logits_processor import LogitProcessorOutput
|
13
|
-
from sglang.srt.
|
28
|
+
from sglang.srt.model_executor.model_runner import InputMetadata
|
14
29
|
from sglang.srt.models.llama2 import LlamaModel
|
15
30
|
|
16
31
|
|
sglang/srt/models/llava.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
"""Inference-only LLaVa model compatible with HuggingFace weights."""
|
2
17
|
|
3
18
|
from typing import Iterable, List, Optional, Tuple
|
@@ -17,13 +32,13 @@ from vllm.config import CacheConfig
|
|
17
32
|
from vllm.model_executor.layers.quantization.base_config import QuantizationConfig
|
18
33
|
from vllm.model_executor.model_loader.weight_utils import default_weight_loader
|
19
34
|
|
20
|
-
from sglang.srt.managers.
|
21
|
-
from sglang.srt.managers.controller.model_runner import InputMetadata
|
35
|
+
from sglang.srt.managers.schedule_batch import ForwardMode
|
22
36
|
from sglang.srt.mm_utils import (
|
23
37
|
get_anyres_image_grid_shape,
|
24
38
|
unpad_image,
|
25
39
|
unpad_image_shape,
|
26
40
|
)
|
41
|
+
from sglang.srt.model_executor.model_runner import InputMetadata
|
27
42
|
from sglang.srt.models.llama2 import LlamaForCausalLM
|
28
43
|
from sglang.srt.models.mistral import MistralForCausalLM
|
29
44
|
from sglang.srt.models.qwen2 import Qwen2ForCausalLM
|
sglang/srt/models/llavavid.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
"""Inference-only LLaVa video model compatible with HuggingFace weights."""
|
2
17
|
|
3
18
|
from typing import Iterable, List, Optional, Tuple
|
@@ -11,13 +26,13 @@ from vllm.config import CacheConfig
|
|
11
26
|
from vllm.model_executor.layers.quantization.base_config import QuantizationConfig
|
12
27
|
from vllm.model_executor.model_loader.weight_utils import default_weight_loader
|
13
28
|
|
14
|
-
from sglang.srt.managers.
|
15
|
-
from sglang.srt.managers.controller.model_runner import InputMetadata
|
29
|
+
from sglang.srt.managers.schedule_batch import ForwardMode
|
16
30
|
from sglang.srt.mm_utils import (
|
17
31
|
get_anyres_image_grid_shape,
|
18
32
|
unpad_image,
|
19
33
|
unpad_image_shape,
|
20
34
|
)
|
35
|
+
from sglang.srt.model_executor.model_runner import InputMetadata
|
21
36
|
from sglang.srt.models.llama2 import LlamaForCausalLM
|
22
37
|
|
23
38
|
|
sglang/srt/models/minicpm.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
"""Inference-only MiniCPM model compatible with HuggingFace weights."""
|
2
17
|
|
3
18
|
import math
|
@@ -24,7 +39,7 @@ from vllm.model_executor.model_loader.weight_utils import default_weight_loader
|
|
24
39
|
|
25
40
|
from sglang.srt.layers.logits_processor import LogitsProcessor
|
26
41
|
from sglang.srt.layers.radix_attention import RadixAttention
|
27
|
-
from sglang.srt.
|
42
|
+
from sglang.srt.model_executor.model_runner import InputMetadata
|
28
43
|
|
29
44
|
|
30
45
|
class MiniCPMMLP(nn.Module):
|
sglang/srt/models/mistral.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
"""Inference-only Mistral model."""
|
2
17
|
|
3
18
|
from sglang.srt.models.llama2 import LlamaForCausalLM
|
sglang/srt/models/mixtral.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
# Adapted from
|
2
17
|
# https://github.com/vllm-project/vllm/blob/c7f2cf2b7f67bce5842fedfdba508440fe257375/vllm/model_executor/models/mixtral.py#L1
|
3
18
|
"""Inference-only Mixtral model."""
|
@@ -35,7 +50,7 @@ from vllm.utils import print_warning_once
|
|
35
50
|
|
36
51
|
from sglang.srt.layers.logits_processor import LogitsProcessor
|
37
52
|
from sglang.srt.layers.radix_attention import RadixAttention
|
38
|
-
from sglang.srt.
|
53
|
+
from sglang.srt.model_executor.model_runner import InputMetadata
|
39
54
|
|
40
55
|
|
41
56
|
class MixtralMoE(nn.Module):
|
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
# Adapted from
|
2
17
|
# https://github.com/vllm-project/vllm/blob/c7f2cf2b7f67bce5842fedfdba508440fe257375/vllm/model_executor/models/mixtral_quant.py#L1
|
3
18
|
"""Inference-only Mixtral model."""
|
@@ -30,7 +45,7 @@ from vllm.model_executor.model_loader.weight_utils import default_weight_loader
|
|
30
45
|
|
31
46
|
from sglang.srt.layers.logits_processor import LogitsProcessor
|
32
47
|
from sglang.srt.layers.radix_attention import RadixAttention
|
33
|
-
from sglang.srt.
|
48
|
+
from sglang.srt.model_executor.model_runner import InputMetadata
|
34
49
|
|
35
50
|
|
36
51
|
class MixtralMLP(nn.Module):
|
sglang/srt/models/qwen.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
# Adapted from
|
2
17
|
# https://github.com/vllm-project/vllm/blob/c7f2cf2b7f67bce5842fedfdba508440fe257375/vllm/model_executor/models/qwen.py#L1
|
3
18
|
from typing import Any, Dict, Iterable, Optional, Tuple
|
@@ -24,7 +39,7 @@ from vllm.model_executor.model_loader.weight_utils import default_weight_loader
|
|
24
39
|
|
25
40
|
from sglang.srt.layers.logits_processor import LogitsProcessor
|
26
41
|
from sglang.srt.layers.radix_attention import RadixAttention
|
27
|
-
from sglang.srt.
|
42
|
+
from sglang.srt.model_executor.model_runner import InputMetadata
|
28
43
|
|
29
44
|
|
30
45
|
class QWenMLP(nn.Module):
|
sglang/srt/models/qwen2.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
# Adapted from llama2.py
|
2
17
|
# Modify details for the adaptation of Qwen2 model.
|
3
18
|
"""Inference-only Qwen2 model compatible with HuggingFace weights."""
|
@@ -24,7 +39,7 @@ from vllm.model_executor.model_loader.weight_utils import default_weight_loader
|
|
24
39
|
|
25
40
|
from sglang.srt.layers.logits_processor import LogitsProcessor
|
26
41
|
from sglang.srt.layers.radix_attention import RadixAttention
|
27
|
-
from sglang.srt.
|
42
|
+
from sglang.srt.model_executor.model_runner import InputMetadata
|
28
43
|
|
29
44
|
Qwen2Config = None
|
30
45
|
|
sglang/srt/models/qwen2_moe.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
# coding=utf-8
|
2
17
|
# Adapted from
|
3
18
|
# https://github.com/vllm-project/vllm/blob/main/vllm/model_executor/models/qwen2_moe.py
|
@@ -36,7 +51,7 @@ from vllm.sequence import IntermediateTensors, SamplerOutput
|
|
36
51
|
|
37
52
|
from sglang.srt.layers.logits_processor import LogitsProcessor
|
38
53
|
from sglang.srt.layers.radix_attention import RadixAttention
|
39
|
-
from sglang.srt.
|
54
|
+
from sglang.srt.model_executor.model_runner import InputMetadata
|
40
55
|
|
41
56
|
|
42
57
|
class Qwen2MoeMLP(nn.Module):
|
sglang/srt/models/stablelm.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
# Adapted from:
|
2
17
|
# https://github.com/vllm-project/vllm/blob/c7f2cf2b7f67bce5842fedfdba508440fe257375/vllm/model_executor/models/stablelm.py#L1
|
3
18
|
"""Inference-only StableLM-2 (https://huggingface.co/stabilityai/stablelm-2-1_6b)
|
@@ -25,7 +40,7 @@ from vllm.model_executor.model_loader.weight_utils import default_weight_loader
|
|
25
40
|
|
26
41
|
from sglang.srt.layers.logits_processor import LogitsProcessor
|
27
42
|
from sglang.srt.layers.radix_attention import RadixAttention
|
28
|
-
from sglang.srt.
|
43
|
+
from sglang.srt.model_executor.model_runner import InputMetadata
|
29
44
|
|
30
45
|
|
31
46
|
class StablelmMLP(nn.Module):
|
sglang/srt/models/yivl.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
"""
|
2
|
+
Copyright 2023-2024 SGLang Team
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
"""
|
15
|
+
|
1
16
|
"""Inference-only Yi-VL model."""
|
2
17
|
|
3
18
|
from typing import Iterable, Optional, Tuple
|