Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
4353acb4
Unverified
Commit
4353acb4
authored
Sep 27, 2024
by
Liangsheng Yin
Committed by
GitHub
Sep 27, 2024
Browse files
minor: fix config (#1524)
parent
9ae1db0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
python/sglang/srt/configs/model_config.py
python/sglang/srt/configs/model_config.py
+11
-9
No files found.
python/sglang/srt/configs/model_config.py
View file @
4353acb4
...
...
@@ -49,13 +49,13 @@ class ModelConfig:
if
context_length
is
not
None
:
self
.
context_len
=
context_length
else
:
self
.
context_len
=
get_context_length
(
self
.
hf_config
)
self
.
context_len
=
get_context_length
(
self
.
hf_
text_
config
)
# Unify the config keys for hf_config
# Unify the config keys for hf_
text_
config
self
.
head_dim
=
getattr
(
self
.
hf_config
,
self
.
hf_
text_
config
,
"head_dim"
,
self
.
hf_config
.
hidden_size
//
self
.
hf_config
.
num_attention_heads
,
self
.
hf_
text_
config
.
hidden_size
//
self
.
hf_
text_
config
.
num_attention_heads
,
)
# FIXME: temporary special judge for deepseek v2 MLA architecture
...
...
@@ -72,8 +72,10 @@ class ModelConfig:
else
:
self
.
attention_arch
=
AttentionArch
.
MHA
self
.
num_attention_heads
=
self
.
hf_config
.
num_attention_heads
self
.
num_key_value_heads
=
getattr
(
self
.
hf_config
,
"num_key_value_heads"
,
None
)
self
.
num_attention_heads
=
self
.
hf_text_config
.
num_attention_heads
self
.
num_key_value_heads
=
getattr
(
self
.
hf_text_config
,
"num_key_value_heads"
,
None
)
# for Dbrx and MPT models
if
self
.
hf_config
.
model_type
in
[
"dbrx"
,
"mpt"
]:
...
...
@@ -83,9 +85,9 @@ class ModelConfig:
if
self
.
num_key_value_heads
is
None
:
self
.
num_key_value_heads
=
self
.
num_attention_heads
self
.
hidden_size
=
self
.
hf_config
.
hidden_size
self
.
num_hidden_layers
=
self
.
hf_config
.
num_hidden_layers
self
.
vocab_size
=
self
.
hf_config
.
vocab_size
self
.
hidden_size
=
self
.
hf_
text_
config
.
hidden_size
self
.
num_hidden_layers
=
self
.
hf_
text_
config
.
num_hidden_layers
self
.
vocab_size
=
self
.
hf_
text_
config
.
vocab_size
# adapted from https://github.com/vllm-project/vllm/blob/main/vllm/config.py#L289
def
get_total_num_kv_heads
(
self
)
->
int
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment