Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
044076a1
Commit
044076a1
authored
Feb 28, 2025
by
gaoqiong
Browse files
修复w8a8找不到对应config的bug
parent
6b7651af
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
9 deletions
+15
-9
vllm/model_executor/models/gpt_neox.py
vllm/model_executor/models/gpt_neox.py
+6
-6
vllm/model_executor/models/llama.py
vllm/model_executor/models/llama.py
+3
-1
vllm/model_executor/models/qwen.py
vllm/model_executor/models/qwen.py
+3
-1
vllm/model_executor/models/qwen2.py
vllm/model_executor/models/qwen2.py
+3
-1
No files found.
vllm/model_executor/models/gpt_neox.py
View file @
044076a1
...
@@ -370,6 +370,7 @@ class GPTNeoXForCausalLM(nn.Module, SupportsPP):
...
@@ -370,6 +370,7 @@ class GPTNeoXForCausalLM(nn.Module, SupportsPP):
combined_words
=
"|"
.
join
(
lay_key_words
)
combined_words
=
"|"
.
join
(
lay_key_words
)
weight_shapes
=
[]
weight_shapes
=
[]
all_json
=
{}
all_json
=
{}
matched_key_words
=
set
()
for
layername
,
weight
in
params_dict
.
items
():
for
layername
,
weight
in
params_dict
.
items
():
matches
=
re
.
findall
(
combined_words
,
layername
)
matches
=
re
.
findall
(
combined_words
,
layername
)
...
@@ -384,20 +385,19 @@ class GPTNeoXForCausalLM(nn.Module, SupportsPP):
...
@@ -384,20 +385,19 @@ class GPTNeoXForCausalLM(nn.Module, SupportsPP):
weight_data
.
data
.
copy_
(
_weight
)
weight_data
.
data
.
copy_
(
_weight
)
#下面是针对模型记录模型出现k和n值
#下面是针对模型记录模型出现k和n值
elif
len
(
weight_shapes
)
<
4
:
elif
len
(
matched_key_words
)
<
4
and
matches
[
0
]
not
in
matched_key_words
:
#k=weight_data.shape[1]
matched_key_words
.
add
(
matches
[
0
])
#print("n:{},k:{}".format(n,k))
weight_shapes
.
append
({
n
,
k
})
weight_shapes
.
append
({
n
,
k
})
json_file
=
self
.
tritonsingleton
.
get_w8a8json_name
(
n
,
k
)
json_file
=
self
.
tritonsingleton
.
get_w8a8json_name
(
n
,
k
)
configs_dict
=
self
.
tritonsingleton
.
get_triton_cache
(
json_file
,
n
,
k
)
configs_dict
=
self
.
tritonsingleton
.
get_triton_cache
(
json_file
,
n
,
k
)
if
configs_dict
:
if
configs_dict
:
all_json
.
update
(
configs_dict
)
all_json
.
update
(
configs_dict
)
#("weight_shapes:",weight_shapes)
if
self
.
w8a8_strategy
==
1
:
if
self
.
w8a8_strategy
==
1
:
self
.
tritonsingleton
.
triton_json_dict
.
append
(
all_json
)
self
.
tritonsingleton
.
triton_json_dict
.
append
(
all_json
)
#print("self.tritonsingleton.triton_json_dict:",self.tritonsingleton.triton_json_dict)
#找到的所有config都进行一次warmup
#找到的所有config都进行一次warmup
for
key
,
value
in
all_json
.
items
():
for
key
,
value
in
all_json
.
items
():
m
=
int
(
key
.
split
(
'_'
)[
0
])
m
=
int
(
key
.
split
(
'_'
)[
0
])
...
...
vllm/model_executor/models/llama.py
View file @
044076a1
...
@@ -562,6 +562,7 @@ class LlamaModel(nn.Module):
...
@@ -562,6 +562,7 @@ class LlamaModel(nn.Module):
combined_words
=
"|"
.
join
(
lay_key_words
)
combined_words
=
"|"
.
join
(
lay_key_words
)
weight_shapes
=
[]
weight_shapes
=
[]
all_json
=
{}
all_json
=
{}
matched_key_words
=
set
()
for
layername
,
weight
in
params_dict
.
items
():
for
layername
,
weight
in
params_dict
.
items
():
matches
=
re
.
findall
(
combined_words
,
layername
)
matches
=
re
.
findall
(
combined_words
,
layername
)
...
@@ -579,7 +580,8 @@ class LlamaModel(nn.Module):
...
@@ -579,7 +580,8 @@ class LlamaModel(nn.Module):
weight_data
.
data
.
copy_
(
_weight
)
weight_data
.
data
.
copy_
(
_weight
)
#下面是针对模型记录模型出现k和n值
#下面是针对模型记录模型出现k和n值
elif
len
(
weight_shapes
)
<
4
:
elif
len
(
matched_key_words
)
<
4
and
matches
[
0
]
not
in
matched_key_words
:
matched_key_words
.
add
(
matches
[
0
])
k
=
weight_data
.
shape
[
1
]
k
=
weight_data
.
shape
[
1
]
weight_shapes
.
append
({
n
,
k
})
weight_shapes
.
append
({
n
,
k
})
...
...
vllm/model_executor/models/qwen.py
View file @
044076a1
...
@@ -1185,6 +1185,7 @@ class QWenBaseModel(nn.Module, SupportsPP, SupportsLoRA):
...
@@ -1185,6 +1185,7 @@ class QWenBaseModel(nn.Module, SupportsPP, SupportsLoRA):
combined_words
=
"|"
.
join
(
lay_key_words
)
combined_words
=
"|"
.
join
(
lay_key_words
)
weight_shapes
=
[]
weight_shapes
=
[]
all_json
=
{}
all_json
=
{}
matched_key_words
=
set
()
for
layername
in
loaded_params
:
for
layername
in
loaded_params
:
weight
=
params_dict
[
layername
]
weight
=
params_dict
[
layername
]
...
@@ -1199,7 +1200,8 @@ class QWenBaseModel(nn.Module, SupportsPP, SupportsLoRA):
...
@@ -1199,7 +1200,8 @@ class QWenBaseModel(nn.Module, SupportsPP, SupportsLoRA):
weight_data
.
data
.
copy_
(
_weight
)
weight_data
.
data
.
copy_
(
_weight
)
#下面是针对模型记录模型出现k和n值
#下面是针对模型记录模型出现k和n值
elif
len
(
weight_shapes
)
<
4
:
elif
len
(
matched_key_words
)
<
4
and
matches
[
0
]
not
in
matched_key_words
:
matched_key_words
.
add
(
matches
[
0
])
k
=
weight_data
.
shape
[
1
]
k
=
weight_data
.
shape
[
1
]
weight_shapes
.
append
({
n
,
k
})
weight_shapes
.
append
({
n
,
k
})
...
...
vllm/model_executor/models/qwen2.py
View file @
044076a1
...
@@ -539,6 +539,7 @@ class Qwen2Model(nn.Module):
...
@@ -539,6 +539,7 @@ class Qwen2Model(nn.Module):
combined_words
=
"|"
.
join
(
lay_key_words
)
combined_words
=
"|"
.
join
(
lay_key_words
)
weight_shapes
=
[]
weight_shapes
=
[]
all_json
=
{}
all_json
=
{}
matched_key_words
=
set
()
for
layername
in
loaded_params
:
for
layername
in
loaded_params
:
weight
=
params_dict
[
layername
]
weight
=
params_dict
[
layername
]
...
@@ -553,7 +554,8 @@ class Qwen2Model(nn.Module):
...
@@ -553,7 +554,8 @@ class Qwen2Model(nn.Module):
weight_data
.
data
.
copy_
(
_weight
)
weight_data
.
data
.
copy_
(
_weight
)
#下面是针对模型记录模型出现k和n值
#下面是针对模型记录模型出现k和n值
elif
len
(
weight_shapes
)
<
4
:
elif
len
(
matched_key_words
)
<
4
and
matches
[
0
]
not
in
matched_key_words
:
matched_key_words
.
add
(
matches
[
0
])
k
=
weight_data
.
shape
[
1
]
k
=
weight_data
.
shape
[
1
]
weight_shapes
.
append
({
n
,
k
})
weight_shapes
.
append
({
n
,
k
})
...
...
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