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
@@ -14,9 +14,7 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
"""
|
||||
Processor class for MiniCPMO.
|
||||
"""
|
||||
"""Processor class for MiniCPMO."""
|
||||
|
||||
import math
|
||||
from typing import Literal, TypeAlias
|
||||
@@ -35,8 +33,7 @@ MiniCPMOBatchFeature: TypeAlias = BatchFeature
|
||||
|
||||
|
||||
class MiniCPMOProcessor(ProcessorMixin):
|
||||
r"""
|
||||
Constructs a MiniCPMV processor which wraps a MiniCPMV image
|
||||
r"""Constructs a MiniCPMV processor which wraps a MiniCPMV image
|
||||
processor and a MiniCPMV tokenizer into a single processor.
|
||||
|
||||
[`MiniCPMVProcessor`] offers all the functionalities of
|
||||
@@ -49,6 +46,7 @@ class MiniCPMOProcessor(ProcessorMixin):
|
||||
The image processor is a required input.
|
||||
tokenizer ([`LlamaTokenizerWrapper`], *optional*):
|
||||
The tokenizer is a required input.
|
||||
|
||||
"""
|
||||
|
||||
attributes = ["image_processor", "feature_extractor", "tokenizer"]
|
||||
@@ -253,8 +251,7 @@ class MiniCPMOProcessor(ProcessorMixin):
|
||||
# Copied from transformers.models.clip.processing_clip.CLIPProcessor.batch_decode
|
||||
# with CLIP->Llama
|
||||
def batch_decode(self, *args, **kwargs):
|
||||
"""
|
||||
This method forwards all its arguments to LlamaTokenizerFast's
|
||||
"""This method forwards all its arguments to LlamaTokenizerFast's
|
||||
[`~PythonBackend.batch_decode`]. Please refer to the
|
||||
docstring of this method for more information.
|
||||
"""
|
||||
@@ -274,8 +271,7 @@ class MiniCPMOProcessor(ProcessorMixin):
|
||||
# Copied from transformers.models.clip.processing_clip.CLIPProcessor.decode
|
||||
# with CLIP->Llama
|
||||
def decode(self, *args, **kwargs):
|
||||
"""
|
||||
This method forwards all its arguments to LlamaTokenizerFast's
|
||||
"""This method forwards all its arguments to LlamaTokenizerFast's
|
||||
[`~PythonBackend.decode`]. Please refer to the docstring
|
||||
of this method for more information.
|
||||
"""
|
||||
@@ -551,15 +547,11 @@ class MelSpectrogramFeatures(torch.nn.Module):
|
||||
)
|
||||
|
||||
def __call__(self, audio: torch.Tensor) -> torch.Tensor:
|
||||
"""
|
||||
audio: Tensor([num_channels, num_samples])
|
||||
"""
|
||||
"""audio: Tensor([num_channels, num_samples])."""
|
||||
return super().__call__(audio)
|
||||
|
||||
def forward(self, audio: torch.Tensor) -> torch.Tensor:
|
||||
"""
|
||||
audio: Tensor([num_channels, num_samples])
|
||||
"""
|
||||
"""audio: Tensor([num_channels, num_samples])."""
|
||||
mel: torch.Tensor = self.mel_spec(audio)
|
||||
features = torch.log(torch.clip(mel, min=1e-5))
|
||||
return features
|
||||
|
||||
Reference in New Issue
Block a user