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
@@ -93,13 +93,12 @@ POOLING_SIZE = 2
|
||||
|
||||
|
||||
class MolmoImageInputs(TensorSchema):
|
||||
"""
|
||||
Dimensions:
|
||||
- bn: Batch size * number of images
|
||||
- bnc: Batch size * number of images * number of crops (dynamic)
|
||||
- np: Number of patches
|
||||
- tp: Token sequence positions
|
||||
- pd: Patch dimension
|
||||
"""Dimensions:
|
||||
- bn: Batch size * number of images
|
||||
- bnc: Batch size * number of images * number of crops (dynamic)
|
||||
- np: Number of patches
|
||||
- tp: Token sequence positions
|
||||
- pd: Patch dimension
|
||||
"""
|
||||
|
||||
images: Annotated[torch.Tensor, TensorShape("bnc", "np", "pd")]
|
||||
@@ -382,9 +381,7 @@ class VisionTransformer(nn.Module):
|
||||
def forward(
|
||||
self, x: torch.Tensor, patch_num: tuple[int, int] | None = None
|
||||
) -> list[torch.Tensor]:
|
||||
"""
|
||||
: param x: (batch_size, num_patch, n_pixels)
|
||||
"""
|
||||
""": param x: (batch_size, num_patch, n_pixels)."""
|
||||
if patch_num is None:
|
||||
patch_num = self.patch_num
|
||||
B, N, D = x.shape
|
||||
@@ -728,9 +725,7 @@ class MolmoVisionBackbone(nn.Module, SupportsQuant):
|
||||
return self.image_vit.patch_embedding.weight.device
|
||||
|
||||
def encode_image(self, images: torch.Tensor) -> torch.Tensor:
|
||||
"""
|
||||
: param images: (batch_size, num_crops, num_patch, n_pixels)
|
||||
"""
|
||||
""": param images: (batch_size, num_crops, num_patch, n_pixels)."""
|
||||
B, T, N, D = images.shape
|
||||
|
||||
mask = ~torch.all(images.view(B * T, N, D) == -1, dim=(1, 2), keepdim=True)
|
||||
@@ -1456,9 +1451,7 @@ class MolmoForCausalLM(
|
||||
return loader.load_weights(weights, mapper=self.hf_to_vllm_mapper)
|
||||
|
||||
def get_mm_mapping(self) -> MultiModelKeys:
|
||||
"""
|
||||
Get the module prefix in multimodal models
|
||||
"""
|
||||
"""Get the module prefix in multimodal models."""
|
||||
return MultiModelKeys.from_string_field(
|
||||
language_model="model",
|
||||
connector="vision_backbone.image_projector",
|
||||
|
||||
Reference in New Issue
Block a user