[MM][CG] Enable encoder CUDA Graph for MiniCPM-V (#42785)
Signed-off-by: YunzhuLu <lucia.yunzhu@gmail.com> Signed-off-by: Isotr0py <Isotr0py@outlook.com> Co-authored-by: Isotr0py <Isotr0py@outlook.com>
This commit is contained in:
@@ -7,6 +7,7 @@ from bisect import bisect_right
|
||||
from collections.abc import (
|
||||
AsyncGenerator,
|
||||
Callable,
|
||||
Hashable,
|
||||
Mapping,
|
||||
MutableSequence,
|
||||
Sequence,
|
||||
@@ -1875,6 +1876,11 @@ class SupportsEncoderCudaGraph(Protocol):
|
||||
- Qwen-family: slice concatenated pixel_values by cumulative
|
||||
patch offsets, subset grid_thw by indices.
|
||||
- Batched models (CLIP): index pixel_values along dim 0.
|
||||
|
||||
Models that configure ``EncoderCudaGraphConfig.capture_axes`` must
|
||||
additionally store the resolved per-axis keys (one key per axis, in
|
||||
order) under ``ENCODER_CUDAGRAPH_AXIS_KEYS_KWARG`` in the returned
|
||||
dict; the manager pops it before the kwargs are used elsewhere.
|
||||
"""
|
||||
...
|
||||
|
||||
@@ -1909,8 +1915,16 @@ class SupportsEncoderCudaGraph(Protocol):
|
||||
device: torch.device,
|
||||
dtype: torch.dtype,
|
||||
path: str = "default",
|
||||
axis_keys: tuple[Hashable, ...] | None = None,
|
||||
) -> "EncoderCudaGraphCaptureInputs":
|
||||
"""Create dummy inputs and buffers for CUDA graph capture."""
|
||||
"""Create dummy inputs and buffers for CUDA graph capture.
|
||||
|
||||
Args:
|
||||
axis_keys: The resolved capture-axis keys (one per axis of
|
||||
``EncoderCudaGraphConfig.capture_axes``) this capture is for.
|
||||
None or empty when no capture axes are configured; models
|
||||
without capture axes ignore it.
|
||||
"""
|
||||
...
|
||||
|
||||
def prepare_encoder_cudagraph_replay_buffers(
|
||||
|
||||
Reference in New Issue
Block a user