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
@@ -275,14 +275,14 @@ class MiMoVisionAttention(nn.Module):
|
||||
max_seqlen: torch.Tensor,
|
||||
full_attn: bool = True,
|
||||
) -> torch.Tensor:
|
||||
"""
|
||||
Args:
|
||||
x: [seq_len, batch=1, embed_dim] (seq-first convention)
|
||||
cu_seqlens: cumulative sequence lengths [num_seqs+1], int32
|
||||
rotary_pos_emb_cos: [seq_len, qk_channels // 2]
|
||||
rotary_pos_emb_sin: [seq_len, qk_channels // 2]
|
||||
max_seqlen: maximum sequence length
|
||||
full_attn: if True, full attention; if False, window attention
|
||||
"""Args:
|
||||
x: [seq_len, batch=1, embed_dim] (seq-first convention)
|
||||
cu_seqlens: cumulative sequence lengths [num_seqs+1], int32
|
||||
rotary_pos_emb_cos: [seq_len, qk_channels // 2]
|
||||
rotary_pos_emb_sin: [seq_len, qk_channels // 2]
|
||||
max_seqlen: maximum sequence length
|
||||
full_attn: if True, full attention; if False, window attention
|
||||
|
||||
"""
|
||||
# [seq_len, 1, embed_dim] -> QKV projection
|
||||
qkv, _ = self.qkv(x) # [seq_len, 1, q_size + kv_size + kv_size]
|
||||
@@ -531,6 +531,7 @@ class MiMoVisionTransformer(nn.Module):
|
||||
Returns:
|
||||
cos: [total_tokens, qk_channels // 2]
|
||||
sin: [total_tokens, qk_channels // 2]
|
||||
|
||||
"""
|
||||
cos_list, sin_list = [], []
|
||||
for i in range(grid_thw.size(0)):
|
||||
@@ -576,12 +577,12 @@ class MiMoVisionTransformer(nn.Module):
|
||||
return torch.cat(cos_list, dim=0), torch.cat(sin_list, dim=0)
|
||||
|
||||
def forward(self, x: torch.Tensor, grid_thw: torch.Tensor) -> torch.Tensor:
|
||||
"""
|
||||
Args:
|
||||
"""Args:
|
||||
x: [total_tokens, C] pre-flattened patches
|
||||
grid_thw: [num_images, 3] tensor of (t, h, w) for each image/video
|
||||
Returns:
|
||||
[merged_tokens, out_hidden_size]
|
||||
|
||||
"""
|
||||
# Ensure grid_thw is a tensor
|
||||
if not isinstance(grid_thw, torch.Tensor):
|
||||
@@ -1556,8 +1557,10 @@ class MiMoV2OmniForCausalLM(nn.Module, SupportsMultiModal, SupportsPP, SupportsQ
|
||||
batch. **NOTE**: If mrope is enabled (default setting for
|
||||
Qwen2.5-VL opensource models), the shape will be `(3, seq_len)`,
|
||||
otherwise it will be `(seq_len,).
|
||||
"""
|
||||
intermediate_tensors: Intermediate tensors from prior forward pass.
|
||||
inputs_embeds: Optional tensor of input embeddings.
|
||||
|
||||
"""
|
||||
if intermediate_tensors is not None:
|
||||
inputs_embeds = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user