A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 17, 04:15 UTC
[Minor] Remove unused config files (#3039)
Roy committed
Feb 27, 2024 at 09:25 UTC
d9f726c4d0920e705069c005fb3b1042368961ae
8 files changed
+10
-210
vllm/model_executor/models/baichuan.py
+3
-3
@@ -23,6 +23,7 @@ from typing import List, Optional, Tuple
23
24
import torch
25
from torch import nn
26
+from transformers import PretrainedConfig
27
28
from vllm.model_executor.input_metadata import InputMetadata
29
from vllm.model_executor.layers.activation import SiluAndMul
@@ -42,7 +43,6 @@ from vllm.model_executor.sampling_metadata import SamplingMetadata
43
from vllm.model_executor.weight_utils import (default_weight_loader,
44
hf_model_weights_iterator)
45
from vllm.sequence import SamplerOutput
45
-from vllm.transformers_utils.configs.baichuan import BaiChuanConfig
46
47
KVCache = Tuple[torch.Tensor, torch.Tensor]
48
@@ -186,7 +186,7 @@ class BaiChuanAttention(nn.Module):
186
class BaiChuanDecoderLayer(nn.Module):
187
188
def __init__(self,
189
- config: BaiChuanConfig,
189
+ config: PretrainedConfig,
190
position_embedding: str,
191
linear_method: Optional[LinearMethodBase] = None):
192
super().__init__()
@@ -245,7 +245,7 @@ class BaiChuanDecoderLayer(nn.Module):
245
class BaiChuanModel(nn.Module):
246
247
def __init__(self,
248
- config: BaiChuanConfig,
248
+ config: PretrainedConfig,
249
position_embedding: str,
250
linear_method: Optional[LinearMethodBase] = None):
251
super().__init__()
vllm/model_executor/models/olmo.py
+3
-1
@@ -61,7 +61,9 @@ from vllm.model_executor.weight_utils import (
61
hf_model_weights_iterator,
62
)
63
from vllm.sequence import SamplerOutput
64
-from vllm.transformers_utils.configs.olmo import OLMoConfig
64
+
65
+# this model must need this dependency
66
+from hf_olmo import OLMoConfig
67
68
KVCache = Tuple[torch.Tensor, torch.Tensor]
69
vllm/model_executor/models/qwen.py
+4
-4
@@ -8,6 +8,7 @@ from typing import Any, Dict, List, Optional, Tuple
8
9
import torch
10
from torch import nn
11
+from transformers import PretrainedConfig
12
13
from vllm.model_executor.input_metadata import InputMetadata
14
from vllm.model_executor.layers.activation import SiluAndMul
@@ -27,7 +28,6 @@ from vllm.model_executor.sampling_metadata import SamplingMetadata
28
from vllm.model_executor.weight_utils import (default_weight_loader,
29
hf_model_weights_iterator)
30
from vllm.sequence import SamplerOutput
30
-from vllm.transformers_utils.configs.qwen import QWenConfig
31
32
KVCache = Tuple[torch.Tensor, torch.Tensor]
33
@@ -127,7 +127,7 @@ class QWenBlock(nn.Module):
127
128
def __init__(
129
self,
130
- config: QWenConfig,
130
+ config: PretrainedConfig,
131
linear_method: Optional[LinearMethodBase] = None,
132
):
133
super().__init__()
@@ -179,7 +179,7 @@ class QWenModel(nn.Module):
179
180
def __init__(
181
self,
182
- config: QWenConfig,
182
+ config: PretrainedConfig,
183
linear_method: Optional[LinearMethodBase] = None,
184
):
185
super().__init__()
@@ -222,7 +222,7 @@ class QWenLMHeadModel(nn.Module):
222
223
def __init__(
224
self,
225
- config: QWenConfig,
225
+ config: PretrainedConfig,
226
linear_method: Optional[LinearMethodBase] = None,
227
):
228
super().__init__()
vllm/transformers_utils/config.py
-2
@@ -5,10 +5,8 @@ from transformers import AutoConfig, PretrainedConfig
5
from vllm.transformers_utils.configs import *
6
7
_CONFIG_REGISTRY = {
8
- "baichuan": BaiChuanConfig,
8
"chatglm": ChatGLMConfig,
9
"mpt": MPTConfig,
11
- "qwen": QWenConfig,
10
"RefinedWeb": RWConfig, # For tiiuae/falcon-40b(-instruct)
11
"RefinedWebModel": RWConfig, # For tiiuae/falcon-7b(-instruct)
12
}
vllm/transformers_utils/configs/__init__.py
-6
@@ -1,18 +1,12 @@
1
-from vllm.transformers_utils.configs.baichuan import BaiChuanConfig
1
from vllm.transformers_utils.configs.chatglm import ChatGLMConfig
2
from vllm.transformers_utils.configs.mpt import MPTConfig
4
-from vllm.transformers_utils.configs.olmo import OLMoConfig
5
-from vllm.transformers_utils.configs.qwen import QWenConfig
3
# RWConfig is for the original tiiuae/falcon-40b(-instruct) and
4
# tiiuae/falcon-7b(-instruct) models. Newer Falcon models will use the
5
# `FalconConfig` class from the official HuggingFace transformers library.
6
from vllm.transformers_utils.configs.falcon import RWConfig
7
8
__all__ = [
12
- "BaiChuanConfig",
9
"ChatGLMConfig",
10
"MPTConfig",
15
- "OLMoConfig",
16
- "QWenConfig",
11
"RWConfig",
12
]
vllm/transformers_utils/configs/baichuan.py
deleted
-62
@@ -1,62 +0,0 @@
1
-# coding=utf-8
2
-# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
3
-#
4
-# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
5
-# and OPT implementations in this library. It has been modified from its
6
-# original forms to accommodate minor architectural differences compared
7
-# to GPT-NeoX and OPT used by the Meta AI team that trained the model.
8
-#
9
-# Licensed under the Apache License, Version 2.0 (the "License");
10
-# you may not use this file except in compliance with the License.
11
-# You may obtain a copy of the License at
12
-#
13
-# http://www.apache.org/licenses/LICENSE-2.0
14
-#
15
-# Unless required by applicable law or agreed to in writing, software
16
-# distributed under the License is distributed on an "AS IS" BASIS,
17
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
-# See the License for the specific language governing permissions and
19
-# limitations under the License.
20
-
21
-from transformers.configuration_utils import PretrainedConfig
22
-
23
-
24
-class BaiChuanConfig(PretrainedConfig):
25
- model_type = "baichuan"
26
- keys_to_ignore_at_inference = ["past_key_values"]
27
-
28
- def __init__(
29
- self,
30
- vocab_size=64000,
31
- hidden_size=4096,
32
- intermediate_size=11008,
33
- num_hidden_layers=32,
34
- num_attention_heads=32,
35
- hidden_act="silu",
36
- max_position_embeddings=4096,
37
- initializer_range=0.02,
38
- rms_norm_eps=1e-6,
39
- use_cache=True,
40
- pad_token_id=0,
41
- bos_token_id=1,
42
- eos_token_id=2,
43
- tie_word_embeddings=False,
44
- **kwargs,
45
- ):
46
- self.vocab_size = vocab_size
47
- self.max_position_embeddings = max_position_embeddings
48
- self.hidden_size = hidden_size
49
- self.intermediate_size = intermediate_size
50
- self.num_hidden_layers = num_hidden_layers
51
- self.num_attention_heads = num_attention_heads
52
- self.hidden_act = hidden_act
53
- self.initializer_range = initializer_range
54
- self.rms_norm_eps = rms_norm_eps
55
- self.use_cache = use_cache
56
- super().__init__(
57
- pad_token_id=pad_token_id,
58
- bos_token_id=bos_token_id,
59
- eos_token_id=eos_token_id,
60
- tie_word_embeddings=tie_word_embeddings,
61
- **kwargs,
62
- )
vllm/transformers_utils/configs/olmo.py
deleted
-72
@@ -1,72 +0,0 @@
1
-# coding=utf-8
2
-# adapted from https://github.com/allenai/OLMo/blob/v0.2.4/hf_olmo/configuration_olmo.py
3
-"""OLMo configuration"""
4
-from transformers import PretrainedConfig
5
-
6
-
7
-class OLMoConfig(PretrainedConfig):
8
- model_type = 'olmo'
9
- attribute_map = {
10
- 'num_attention_heads': 'n_heads',
11
- 'hidden_size': 'd_model',
12
- 'num_hidden_layers': 'n_layers',
13
- }
14
-
15
- # Note that the defaults for these attributes are equivalent to the base GPT2 model.
16
- def __init__(
17
- self,
18
- d_model=768,
19
- n_heads=12,
20
- n_layers=12,
21
- mlp_ratio=4,
22
- mlp_hidden_size=None,
23
- activation_type="swiglu",
24
- block_type="sequential",
25
- block_group_size=1,
26
- alibi=False,
27
- alibi_bias_max=8.0,
28
- rope=False,
29
- rope_full_precision=True,
30
- multi_query_attention=False,
31
- attention_layer_norm=False,
32
- layer_norm_type="default",
33
- layer_norm_with_affine=True,
34
- attention_layer_norm_with_affine=True,
35
- max_sequence_length=1024,
36
- include_bias=True,
37
- bias_for_layer_norm=None,
38
- scale_logits=False,
39
- vocab_size=50257,
40
- embedding_size=50304,
41
- weight_tying=True,
42
- eos_token_id=50256,
43
- pad_token_id=50256,
44
- **kwargs,
45
- ):
46
- self.d_model = d_model
47
- self.n_heads = n_heads
48
- self.n_layers = n_layers
49
- self.mlp_ratio = mlp_ratio
50
- self.mlp_hidden_size = mlp_hidden_size
51
- self.activation_type = activation_type
52
- self.block_type = block_type
53
- self.block_group_size = block_group_size
54
- self.alibi = alibi
55
- self.alibi_bias_max = alibi_bias_max
56
- self.rope = rope
57
- self.rope_full_precision = rope_full_precision
58
- self.multi_query_attention = multi_query_attention
59
- self.attention_layer_norm = attention_layer_norm
60
- self.layer_norm_type = layer_norm_type
61
- self.layer_norm_with_affine = layer_norm_with_affine
62
- self.attention_layer_norm_with_affine = attention_layer_norm_with_affine
63
- self.max_sequence_length = max_sequence_length
64
- self.include_bias = include_bias
65
- self.bias_for_layer_norm = bias_for_layer_norm
66
- self.scale_logits = scale_logits
67
- self.vocab_size = vocab_size
68
- self.embedding_size = embedding_size
69
- self.weight_tying = weight_tying
70
- self.eos_token_id = eos_token_id
71
- self.pad_token_id = pad_token_id
72
- super().__init__(**kwargs)
vllm/transformers_utils/configs/qwen.py
deleted
-60
@@ -1,60 +0,0 @@
1
-# Copyright (c) Alibaba Cloud.
2
-# LICENSE: https://huggingface.co/Qwen/Qwen-7B/blob/main/LICENSE
3
-
4
-from transformers import PretrainedConfig
5
-
6
-
7
-class QWenConfig(PretrainedConfig):
8
- model_type = "qwen"
9
- keys_to_ignore_at_inference = ["past_key_values"]
10
-
11
- def __init__(
12
- self,
13
- vocab_size=151936,
14
- hidden_size=4096,
15
- num_hidden_layers=32,
16
- num_attention_heads=32,
17
- emb_dropout_prob=0.0,
18
- attn_dropout_prob=0.0,
19
- layer_norm_epsilon=1e-6,
20
- initializer_range=0.02,
21
- max_position_embeddings=8192,
22
- scale_attn_weights=True,
23
- use_cache=True,
24
- bf16=False,
25
- fp16=False,
26
- fp32=False,
27
- kv_channels=128,
28
- rotary_pct=1.0,
29
- rotary_emb_base=10000,
30
- use_dynamic_ntk=True,
31
- use_logn_attn=True,
32
- use_flash_attn="auto",
33
- intermediate_size=22016,
34
- no_bias=True,
35
- tie_word_embeddings=False,
36
- **kwargs,
37
- ):
38
- self.vocab_size = vocab_size
39
- self.hidden_size = hidden_size
40
- self.intermediate_size = intermediate_size
41
- self.num_hidden_layers = num_hidden_layers
42
- self.num_attention_heads = num_attention_heads
43
- self.emb_dropout_prob = emb_dropout_prob
44
- self.attn_dropout_prob = attn_dropout_prob
45
- self.layer_norm_epsilon = layer_norm_epsilon
46
- self.initializer_range = initializer_range
47
- self.scale_attn_weights = scale_attn_weights
48
- self.use_cache = use_cache
49
- self.max_position_embeddings = max_position_embeddings
50
- self.bf16 = bf16
51
- self.fp16 = fp16
52
- self.fp32 = fp32
53
- self.kv_channels = kv_channels
54
- self.rotary_pct = rotary_pct
55
- self.rotary_emb_base = rotary_emb_base
56
- self.use_dynamic_ntk = use_dynamic_ntk
57
- self.use_logn_attn = use_logn_attn
58
- self.use_flash_attn = use_flash_attn
59
- self.no_bias = no_bias
60
- super().__init__(tie_word_embeddings=tie_word_embeddings, **kwargs)