Add pydocstyle to the ruff rules (#52136)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Signed-off-by: Harry Mellor <hej.mellor@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
804e5377aa
commit
8c1557a79c
@@ -125,13 +125,12 @@ def smart_resize(
|
||||
|
||||
|
||||
class KeyeImagePixelInputs(TensorSchema):
|
||||
"""
|
||||
Dimensions:
|
||||
- bnp: Batch size * Number of patches
|
||||
- c: Number of channels
|
||||
- ps: Patch size
|
||||
- ni: Number of images
|
||||
- g: Grid dimensions (3 for t, h, w)
|
||||
"""Dimensions:
|
||||
- bnp: Batch size * Number of patches
|
||||
- c: Number of channels
|
||||
- ps: Patch size
|
||||
- ni: Number of images
|
||||
- g: Grid dimensions (3 for t, h, w)
|
||||
"""
|
||||
|
||||
type: Literal["pixel_values"]
|
||||
@@ -142,13 +141,12 @@ class KeyeImagePixelInputs(TensorSchema):
|
||||
|
||||
|
||||
class KeyeImageEmbeddingInputs(TensorSchema):
|
||||
"""
|
||||
Dimensions:
|
||||
- nf: Number of image features
|
||||
- hs: Hidden size (must match the hidden size of language model
|
||||
backbone)
|
||||
- ni: Number of images
|
||||
- g: Grid dimensions (3 for t, h, w)
|
||||
"""Dimensions:
|
||||
- nf: Number of image features
|
||||
- hs: Hidden size (must match the hidden size of language model
|
||||
backbone)
|
||||
- ni: Number of images
|
||||
- g: Grid dimensions (3 for t, h, w)
|
||||
"""
|
||||
|
||||
type: Literal["image_embeds"]
|
||||
@@ -160,13 +158,12 @@ KeyeImageInputs: TypeAlias = KeyeImagePixelInputs | KeyeImageEmbeddingInputs
|
||||
|
||||
|
||||
class KeyeVideoPixelInputs(TensorSchema):
|
||||
"""
|
||||
Dimensions:
|
||||
- bnp: Batch size * Number of patches
|
||||
- c: Number of channels
|
||||
- ps: Patch size
|
||||
- ni: Number of images
|
||||
- g: Grid dimensions (3 for t, h, w)
|
||||
"""Dimensions:
|
||||
- bnp: Batch size * Number of patches
|
||||
- c: Number of channels
|
||||
- ps: Patch size
|
||||
- ni: Number of images
|
||||
- g: Grid dimensions (3 for t, h, w)
|
||||
"""
|
||||
|
||||
type: Literal["pixel_values_videos"]
|
||||
@@ -177,13 +174,12 @@ class KeyeVideoPixelInputs(TensorSchema):
|
||||
|
||||
|
||||
class KeyeVideoEmbeddingInputs(TensorSchema):
|
||||
"""
|
||||
Dimensions:
|
||||
- nf: Number of video features
|
||||
- hs: Hidden size (must match the hidden size of language model
|
||||
backbone)
|
||||
- nv: Number of videos
|
||||
- g: Grid dimensions (3 for t, h, w)
|
||||
"""Dimensions:
|
||||
- nf: Number of video features
|
||||
- hs: Hidden size (must match the hidden size of language model
|
||||
backbone)
|
||||
- nv: Number of videos
|
||||
- g: Grid dimensions (3 for t, h, w)
|
||||
"""
|
||||
|
||||
type: Literal["video_embeds"]
|
||||
@@ -349,7 +345,8 @@ def apply_rotary_pos_emb_flashatt(
|
||||
|
||||
class KeyeSiglipAttention(nn.Module):
|
||||
"""Multi-headed attention from 'Attention Is All You
|
||||
Need' paper."""
|
||||
Need' paper.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -1465,6 +1462,9 @@ class BaseKeyeModule(nn.Module, SupportsMultiModal):
|
||||
otherwise it will be `(seq_len,)`.
|
||||
intermediate_tensors: Intermediate tensors from prior forward pass.
|
||||
inputs_embeds: Optional tensor of input embeddings.
|
||||
**kwargs: Multimodal inputs for this batch, forwarded to the
|
||||
multimodal embedding path.
|
||||
|
||||
"""
|
||||
if intermediate_tensors is not None:
|
||||
inputs_embeds = None
|
||||
@@ -1588,8 +1588,7 @@ class KeyeForConditionalGeneration(
|
||||
def _split_video_grid_thw(
|
||||
grid_thw: torch.Tensor | list[list[int]] | list[int],
|
||||
) -> list[list[int]]:
|
||||
"""
|
||||
Split video grid_thw along the t dimension into per-frame rows.
|
||||
"""Split video grid_thw along the t dimension into per-frame rows.
|
||||
|
||||
This preserves Keye's current M-RoPE behavior, where a video is emitted
|
||||
as consecutive frame-level multimodal blocks rather than a single block
|
||||
|
||||
Reference in New Issue
Block a user