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
77cf771e
"docs/vscode:/vscode.git/clone" did not exist on "6c0746662b6db1bae775c88a5b58addf0eb6db56"
Unverified
Commit
77cf771e
authored
Mar 25, 2025
by
Ke Bao
Committed by
GitHub
Mar 24, 2025
Browse files
Fix EAGLE3 for llama3.3 70b (#4716)
parent
8154de5a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
python/sglang/srt/models/llama.py
python/sglang/srt/models/llama.py
+6
-0
python/sglang/srt/models/llama_eagle3.py
python/sglang/srt/models/llama_eagle3.py
+4
-1
No files found.
python/sglang/srt/models/llama.py
View file @
77cf771e
...
@@ -610,6 +610,12 @@ class LlamaForCausalLM(nn.Module):
...
@@ -610,6 +610,12 @@ class LlamaForCausalLM(nn.Module):
return
self
.
model
.
embed_tokens
.
weight
return
self
.
model
.
embed_tokens
.
weight
def
set_embed
(
self
,
embed
):
def
set_embed
(
self
,
embed
):
# NOTE: If draft hidden size != target hidden size, the embed weight cannot be shared for EAGLE3
if
(
hasattr
(
self
.
config
,
"target_hidden_size"
)
and
self
.
config
.
target_hidden_size
!=
self
.
config
.
hidden_size
):
return
del
self
.
model
.
embed_tokens
.
weight
del
self
.
model
.
embed_tokens
.
weight
self
.
model
.
embed_tokens
.
weight
=
embed
self
.
model
.
embed_tokens
.
weight
=
embed
torch
.
cuda
.
empty_cache
()
torch
.
cuda
.
empty_cache
()
...
...
python/sglang/srt/models/llama_eagle3.py
View file @
77cf771e
...
@@ -105,6 +105,9 @@ class LlamaModel(nn.Module):
...
@@ -105,6 +105,9 @@ class LlamaModel(nn.Module):
prefix
=
add_prefix
(
"embed_tokens"
,
prefix
),
prefix
=
add_prefix
(
"embed_tokens"
,
prefix
),
)
)
self
.
midlayer
=
LlamaDecoderLayer
(
config
,
0
,
quant_config
,
prefix
)
self
.
midlayer
=
LlamaDecoderLayer
(
config
,
0
,
quant_config
,
prefix
)
if
hasattr
(
config
,
"target_hidden_size"
):
self
.
fc
=
torch
.
nn
.
Linear
(
config
.
target_hidden_size
*
3
,
config
.
hidden_size
)
else
:
self
.
fc
=
torch
.
nn
.
Linear
(
config
.
hidden_size
*
3
,
config
.
hidden_size
)
self
.
fc
=
torch
.
nn
.
Linear
(
config
.
hidden_size
*
3
,
config
.
hidden_size
)
self
.
norm
=
RMSNorm
(
config
.
hidden_size
,
eps
=
config
.
rms_norm_eps
)
self
.
norm
=
RMSNorm
(
config
.
hidden_size
,
eps
=
config
.
rms_norm_eps
)
...
...
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