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:
Harry Mellor
2026-09-16 16:44:29 +00:00
committed by GitHub
co-authored by Claude Opus 5
parent 804e5377aa
commit 8c1557a79c
2002 changed files with 15024 additions and 14269 deletions
+18 -23
View File
@@ -74,12 +74,11 @@ TOKENS_PER_AUDIO = 188
class Gemma3nImagePixelInputs(TensorSchema):
"""
Dimensions:
- bn: Batch size * number of images
- c: Number of channels (3)
- h: Height of each patch
- w: Width of each patch
"""Dimensions:
- bn: Batch size * number of images
- c: Number of channels (3)
- h: Height of each patch
- w: Width of each patch
"""
type: Literal["pixel_values"] = "pixel_values"
@@ -113,6 +112,7 @@ def batch_audio_features(
Returns:
The `(bn, s_max, f)` features and their `(bn, s_max)` mask.
"""
if isinstance(input_features, torch.Tensor):
assert isinstance(input_features_mask, torch.Tensor)
@@ -135,11 +135,10 @@ def batch_audio_features(
class Gemma3nAudioInputs(TensorSchema):
"""
Dimensions:
- bn: Batch size * number of audios
- s: seq_length
- f: num_features
"""Dimensions:
- bn: Batch size * number of audios
- s: seq_length
- f: num_features
"""
type: Literal["audio"] = "audio"
@@ -187,8 +186,7 @@ class Gemma3nProcessingInfo(BaseProcessingInfo):
image_height: int,
processor: Gemma3nProcessor,
) -> PromptUpdateDetails:
"""
Get the replacement metadata for image tokens.
"""Get the replacement metadata for image tokens.
For Gemma3n, this should return the full_image_sequence which includes
BOI token, repeated image tokens, and EOI token.
@@ -205,8 +203,7 @@ class Gemma3nProcessingInfo(BaseProcessingInfo):
*,
processor: Gemma3nProcessor,
) -> PromptUpdateDetails:
"""
Get the replacement metadata for audio tokens.
"""Get the replacement metadata for audio tokens.
For Gemma3n, this should return the full_audio_sequence which includes
BOA token, repeated audio tokens, and EOA token.
@@ -316,8 +313,7 @@ class Gemma3nMultiModalProcessor(BaseMultiModalProcessor[Gemma3nProcessingInfo])
return processed_data
def _get_num_audio_frames_alone(self, num_samples: int) -> int:
"""
Get the number of mel frames that the feature extractor produces
"""Get the number of mel frames that the feature extractor produces
for a single audio clip of the given length, independent of batch
padding.
"""
@@ -514,7 +510,8 @@ class Gemma3nMultiModalProcessor(BaseMultiModalProcessor[Gemma3nProcessingInfo])
class Gemma3nMultimodalEmbedder(nn.Module):
"""Embeds token ids or soft tokens for multimodal content into language
model space."""
model space.
"""
def __init__(
self,
@@ -571,6 +568,7 @@ class Gemma3nMultimodalEmbedder(nn.Module):
Returns:
A torch.Tensor of embeddings with shape `[batch_size, seq_len, self.config.text_config.hidden_size]`.
""" # noqa: E501
if (input_ids is None) ^ (inputs_embeds is not None):
raise ValueError(
@@ -891,9 +889,7 @@ class Gemma3nForConditionalGeneration(
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="language_model",
connector="multi_modal_projector",
@@ -911,8 +907,7 @@ class Gemma3nForConditionalGeneration(
@classmethod
def get_generation_prompt(cls, stt_params: SpeechToTextParams) -> PromptType:
"""
Gemma3n supports "free-form" transcription.
"""Gemma3n supports "free-form" transcription.
We fix its prompt here to standardize transcriptions/translations
requests.
"""