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
51797775
Unverified
Commit
51797775
authored
May 21, 2025
by
Shane A
Committed by
GitHub
May 21, 2025
Browse files
[Bugfix][Model] Make Olmo2Model weight loading return loaded weights (#18504)
Signed-off-by:
Shane A
<
shanea@allenai.org
>
parent
cf5984b2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
vllm/model_executor/models/olmo2.py
vllm/model_executor/models/olmo2.py
+5
-1
No files found.
vllm/model_executor/models/olmo2.py
View file @
51797775
...
@@ -314,7 +314,8 @@ class Olmo2Model(nn.Module):
...
@@ -314,7 +314,8 @@ class Olmo2Model(nn.Module):
hidden_states
=
self
.
norm
(
hidden_states
)
hidden_states
=
self
.
norm
(
hidden_states
)
return
hidden_states
return
hidden_states
def
load_weights
(
self
,
weights
:
Iterable
[
tuple
[
str
,
torch
.
Tensor
]]):
def
load_weights
(
self
,
weights
:
Iterable
[
tuple
[
str
,
torch
.
Tensor
]])
->
set
[
str
]:
stacked_params_mapping
=
[
stacked_params_mapping
=
[
# (param_name, shard_name, shard_id)
# (param_name, shard_name, shard_id)
(
"qkv_proj"
,
"q_proj"
,
"q"
),
(
"qkv_proj"
,
"q_proj"
,
"q"
),
...
@@ -325,6 +326,7 @@ class Olmo2Model(nn.Module):
...
@@ -325,6 +326,7 @@ class Olmo2Model(nn.Module):
]
]
params_dict
=
dict
(
self
.
named_parameters
(
remove_duplicate
=
False
))
params_dict
=
dict
(
self
.
named_parameters
(
remove_duplicate
=
False
))
loaded_params
:
set
[
str
]
=
set
()
for
name
,
loaded_weight
in
weights
:
for
name
,
loaded_weight
in
weights
:
if
is_pp_missing_parameter
(
name
,
self
):
if
is_pp_missing_parameter
(
name
,
self
):
continue
continue
...
@@ -347,6 +349,8 @@ class Olmo2Model(nn.Module):
...
@@ -347,6 +349,8 @@ class Olmo2Model(nn.Module):
weight_loader
=
getattr
(
param
,
"weight_loader"
,
weight_loader
=
getattr
(
param
,
"weight_loader"
,
default_weight_loader
)
default_weight_loader
)
weight_loader
(
param
,
loaded_weight
)
weight_loader
(
param
,
loaded_weight
)
loaded_params
.
add
(
name
)
return
loaded_params
class
Olmo2ForCausalLM
(
nn
.
Module
,
SupportsPP
):
class
Olmo2ForCausalLM
(
nn
.
Module
,
SupportsPP
):
...
...
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