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
736569da
Unverified
Commit
736569da
authored
Sep 10, 2025
by
zzhxxx
Committed by
GitHub
Sep 10, 2025
Browse files
[Platform] Custom ops support for LMhead and LogitsProcessor (#23564)
Signed-off-by:
zzhx1
<
zzh_201018@outlook.com
>
parent
2eb9986a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
vllm/model_executor/layers/logits_processor.py
vllm/model_executor/layers/logits_processor.py
+3
-2
vllm/model_executor/layers/vocab_parallel_embedding.py
vllm/model_executor/layers/vocab_parallel_embedding.py
+1
-0
No files found.
vllm/model_executor/layers/logits_processor.py
View file @
736569da
...
@@ -6,11 +6,11 @@ from concurrent.futures import ThreadPoolExecutor
...
@@ -6,11 +6,11 @@ from concurrent.futures import ThreadPoolExecutor
from
typing
import
Optional
from
typing
import
Optional
import
torch
import
torch
import
torch.nn
as
nn
import
vllm.envs
as
envs
import
vllm.envs
as
envs
from
vllm.distributed
import
(
tensor_model_parallel_all_gather
,
from
vllm.distributed
import
(
tensor_model_parallel_all_gather
,
tensor_model_parallel_gather
)
tensor_model_parallel_gather
)
from
vllm.model_executor.custom_op
import
CustomOp
from
vllm.model_executor.layers.vocab_parallel_embedding
import
(
from
vllm.model_executor.layers.vocab_parallel_embedding
import
(
VocabParallelEmbedding
)
VocabParallelEmbedding
)
from
vllm.model_executor.sampling_metadata
import
SamplingMetadata
from
vllm.model_executor.sampling_metadata
import
SamplingMetadata
...
@@ -22,7 +22,8 @@ if envs.VLLM_LOGITS_PROCESSOR_THREADS is not None:
...
@@ -22,7 +22,8 @@ if envs.VLLM_LOGITS_PROCESSOR_THREADS is not None:
envs
.
VLLM_LOGITS_PROCESSOR_THREADS
)
envs
.
VLLM_LOGITS_PROCESSOR_THREADS
)
class
LogitsProcessor
(
nn
.
Module
):
@
CustomOp
.
register
(
"logits_processor"
)
class
LogitsProcessor
(
CustomOp
):
"""Process logits and apply logits processors from sampling metadata.
"""Process logits and apply logits processors from sampling metadata.
This layer does the following:
This layer does the following:
...
...
vllm/model_executor/layers/vocab_parallel_embedding.py
View file @
736569da
...
@@ -429,6 +429,7 @@ class VocabParallelEmbedding(CustomOp):
...
@@ -429,6 +429,7 @@ class VocabParallelEmbedding(CustomOp):
return
s
return
s
@
CustomOp
.
register
(
"parallel_lm_head"
)
class
ParallelLMHead
(
VocabParallelEmbedding
):
class
ParallelLMHead
(
VocabParallelEmbedding
):
"""Parallelized LM head.
"""Parallelized LM head.
...
...
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