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
8f5b9910
"vscode:/vscode.git/clone" did not exist on "625efeb8ebc75a9167c8abc9f0e7afe10b120be5"
Unverified
Commit
8f5b9910
authored
Aug 21, 2025
by
nathan
Committed by
GitHub
Aug 20, 2025
Browse files
Add support for Qwen3-seq-cls (#9357)
parent
ef3004d9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
python/sglang/srt/models/qwen3_classification.py
python/sglang/srt/models/qwen3_classification.py
+7
-1
No files found.
python/sglang/srt/models/qwen3_classification.py
View file @
8f5b9910
...
...
@@ -42,7 +42,13 @@ class Qwen3ForSequenceClassification(nn.Module):
# Use normalize=True for qwen3 embedding based on official implementation
# Reference: https://github.com/QwenLM/Qwen3-Embedding/blob/main/examples/qwen3_embedding_transformers.py#L55
# Official code: output = F.normalize(output, p=2, dim=1)
self
.
pooler
=
Pooler
(
pooling_type
=
PoolingType
.
LAST
,
normalize
=
True
)
normalize
=
True
# We don't want to normalize the embedding if we have a classification head
if
config
.
id2label
is
not
None
or
config
.
label2id
is
not
None
:
normalize
=
False
self
.
pooler
=
Pooler
(
pooling_type
=
PoolingType
.
LAST
,
normalize
=
normalize
)
self
.
eos_token_id
=
config
.
eos_token_id
...
...
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