[Doc] Add developer guide for CustomOp (#30886)
Signed-off-by: shen-shanshan <467638484@qq.com>
This commit is contained in:
@@ -10,10 +10,13 @@ from vllm.model_executor.custom_op import CustomOp
|
||||
from .common import ApplyRotaryEmb
|
||||
|
||||
|
||||
# --8<-- [start:rotary_embedding]
|
||||
@CustomOp.register("rotary_embedding")
|
||||
class RotaryEmbeddingBase(CustomOp):
|
||||
"""Original rotary positional embedding."""
|
||||
|
||||
# --8<-- [end:rotary_embedding]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
head_size: int,
|
||||
|
||||
@@ -118,8 +118,11 @@ direct_register_custom_op(
|
||||
)
|
||||
|
||||
|
||||
# --8<-- [start:apply_rotary_emb]
|
||||
@CustomOp.register("apply_rotary_emb")
|
||||
class ApplyRotaryEmb(CustomOp):
|
||||
# --8<-- [end:apply_rotary_emb]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
enforce_enable: bool = False,
|
||||
|
||||
@@ -9,10 +9,13 @@ from vllm.model_executor.custom_op import CustomOp
|
||||
from .common import rotate_gptj, rotate_neox
|
||||
|
||||
|
||||
# --8<-- [start:dual_chunk_rotary_embedding]
|
||||
@CustomOp.register("dual_chunk_rotary_embedding")
|
||||
class DualChunkRotaryEmbedding(CustomOp):
|
||||
"""Rotary positional embedding for Dual Chunk Attention."""
|
||||
|
||||
# --8<-- [end:dual_chunk_rotary_embedding]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
head_size: int,
|
||||
|
||||
Reference in New Issue
Block a user