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
c9ee3d35
Unverified
Commit
c9ee3d35
authored
Jul 15, 2024
by
Liangsheng Yin
Committed by
GitHub
Jul 15, 2024
Browse files
Fix model forward grad (#628)
parent
41d1f677
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
14 additions
and
0 deletions
+14
-0
python/sglang/srt/models/chatglm.py
python/sglang/srt/models/chatglm.py
+1
-0
python/sglang/srt/models/dbrx.py
python/sglang/srt/models/dbrx.py
+1
-0
python/sglang/srt/models/grok.py
python/sglang/srt/models/grok.py
+1
-0
python/sglang/srt/models/llama2.py
python/sglang/srt/models/llama2.py
+1
-0
python/sglang/srt/models/llama_classification.py
python/sglang/srt/models/llama_classification.py
+1
-0
python/sglang/srt/models/llava.py
python/sglang/srt/models/llava.py
+1
-0
python/sglang/srt/models/llavavid.py
python/sglang/srt/models/llavavid.py
+1
-0
python/sglang/srt/models/minicpm.py
python/sglang/srt/models/minicpm.py
+1
-0
python/sglang/srt/models/mixtral.py
python/sglang/srt/models/mixtral.py
+1
-0
python/sglang/srt/models/mixtral_quant.py
python/sglang/srt/models/mixtral_quant.py
+1
-0
python/sglang/srt/models/qwen.py
python/sglang/srt/models/qwen.py
+1
-0
python/sglang/srt/models/qwen2.py
python/sglang/srt/models/qwen2.py
+1
-0
python/sglang/srt/models/qwen2_moe.py
python/sglang/srt/models/qwen2_moe.py
+1
-0
python/sglang/srt/models/stablelm.py
python/sglang/srt/models/stablelm.py
+1
-0
No files found.
python/sglang/srt/models/chatglm.py
View file @
c9ee3d35
...
...
@@ -360,6 +360,7 @@ class ChatGLMForCausalLM(nn.Module):
self
.
logits_processor
=
LogitsProcessor
(
config
)
self
.
sampler
=
Sampler
()
@
torch
.
no_grad
()
def
forward
(
self
,
input_ids
:
torch
.
Tensor
,
...
...
python/sglang/srt/models/dbrx.py
View file @
c9ee3d35
...
...
@@ -368,6 +368,7 @@ class DbrxForCausalLM(nn.Module):
)
self
.
logits_processor
=
LogitsProcessor
(
config
)
@
torch
.
no_grad
()
def
forward
(
self
,
input_ids
:
torch
.
Tensor
,
...
...
python/sglang/srt/models/grok.py
View file @
c9ee3d35
...
...
@@ -601,6 +601,7 @@ class Grok1ModelForCausalLM(nn.Module):
# Monkey patch _prepare_weights to load pre-sharded weights
setattr
(
DefaultModelLoader
,
"_prepare_weights"
,
_prepare_presharded_weights
)
@
torch
.
no_grad
()
def
forward
(
self
,
input_ids
:
torch
.
Tensor
,
...
...
python/sglang/srt/models/llama2.py
View file @
c9ee3d35
...
...
@@ -275,6 +275,7 @@ class LlamaForCausalLM(nn.Module):
self
.
lm_head
=
ParallelLMHead
(
config
.
vocab_size
,
config
.
hidden_size
)
self
.
logits_processor
=
LogitsProcessor
(
config
)
@
torch
.
no_grad
()
def
forward
(
self
,
input_ids
:
torch
.
Tensor
,
...
...
python/sglang/srt/models/llama_classification.py
View file @
c9ee3d35
...
...
@@ -31,6 +31,7 @@ class LlamaForClassification(nn.Module):
)
self
.
eos_token_id
=
config
.
eos_token_id
@
torch
.
no_grad
()
def
forward
(
self
,
input_ids
:
torch
.
Tensor
,
...
...
python/sglang/srt/models/llava.py
View file @
c9ee3d35
...
...
@@ -95,6 +95,7 @@ class LlavaLlamaForCausalLM(nn.Module):
return
image_features
@
torch
.
no_grad
()
def
forward
(
self
,
input_ids
:
torch
.
LongTensor
,
...
...
python/sglang/srt/models/llavavid.py
View file @
c9ee3d35
...
...
@@ -106,6 +106,7 @@ class LlavaVidForCausalLM(nn.Module):
return
image_features
@
torch
.
no_grad
()
def
forward
(
self
,
input_ids
:
torch
.
LongTensor
,
...
...
python/sglang/srt/models/minicpm.py
View file @
c9ee3d35
...
...
@@ -283,6 +283,7 @@ class MiniCPMForCausalLM(nn.Module):
self
.
logits_processor
=
LogitsProcessor
(
config
)
@
torch
.
no_grad
()
def
forward
(
self
,
input_ids
:
torch
.
Tensor
,
...
...
python/sglang/srt/models/mixtral.py
View file @
c9ee3d35
...
...
@@ -460,6 +460,7 @@ class MixtralForCausalLM(nn.Module):
self
.
lm_head
=
ParallelLMHead
(
config
.
vocab_size
,
config
.
hidden_size
)
self
.
logits_processor
=
LogitsProcessor
(
config
)
@
torch
.
no_grad
()
def
forward
(
self
,
input_ids
:
torch
.
Tensor
,
...
...
python/sglang/srt/models/mixtral_quant.py
View file @
c9ee3d35
...
...
@@ -322,6 +322,7 @@ class QuantMixtralForCausalLM(nn.Module):
self
.
lm_head
=
ParallelLMHead
(
config
.
vocab_size
,
config
.
hidden_size
)
self
.
logits_processor
=
LogitsProcessor
(
config
)
@
torch
.
no_grad
()
def
forward
(
self
,
input_ids
:
torch
.
Tensor
,
...
...
python/sglang/srt/models/qwen.py
View file @
c9ee3d35
...
...
@@ -237,6 +237,7 @@ class QWenLMHeadModel(nn.Module):
self
.
lm_head
=
ParallelLMHead
(
vocab_size
,
config
.
hidden_size
)
self
.
logits_processor
=
LogitsProcessor
(
config
)
@
torch
.
no_grad
()
def
forward
(
self
,
input_ids
:
torch
.
Tensor
,
...
...
python/sglang/srt/models/qwen2.py
View file @
c9ee3d35
...
...
@@ -261,6 +261,7 @@ class Qwen2ForCausalLM(nn.Module):
self
.
lm_head
=
ParallelLMHead
(
config
.
vocab_size
,
config
.
hidden_size
)
self
.
logits_processor
=
LogitsProcessor
(
config
)
@
torch
.
no_grad
()
def
forward
(
self
,
input_ids
:
torch
.
Tensor
,
...
...
python/sglang/srt/models/qwen2_moe.py
View file @
c9ee3d35
...
...
@@ -355,6 +355,7 @@ class Qwen2MoeForCausalLM(nn.Module):
self
.
logits_processor
=
LogitsProcessor
(
config
)
self
.
sampler
=
Sampler
()
@
torch
.
no_grad
()
def
forward
(
self
,
input_ids
:
torch
.
Tensor
,
...
...
python/sglang/srt/models/stablelm.py
View file @
c9ee3d35
...
...
@@ -235,6 +235,7 @@ class StableLmForCausalLM(nn.Module):
self
.
lm_head
=
ParallelLMHead
(
config
.
vocab_size
,
config
.
hidden_size
)
self
.
logits_processor
=
LogitsProcessor
(
config
)
@
torch
.
no_grad
()
def
forward
(
self
,
input_ids
:
torch
.
Tensor
,
...
...
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