id int64 0 328k | repository_name stringlengths 7 58 | file_path stringlengths 9 302 | class_name stringlengths 5 256 | human_written_code stringlengths 16 2.16M | class_skeleton stringlengths 18 1.49M ⌀ | total_program_units int64 1 1.76k | total_doc_str int64 0 771 | AvgCountLine float64 0 7.89k | AvgCountLineBlank float64 0 297 | AvgCountLineCode float64 0 7.89k | AvgCountLineComment float64 0 7.89k | AvgCyclomatic float64 0 130 | CommentToCodeRatio float64 0 168 | CountClassBase float64 0 40 | CountClassCoupled float64 0 583 | CountClassCoupledModified float64 0 575 | CountClassDerived float64 0 5.35k | CountDeclInstanceMethod float64 0 529 | CountDeclInstanceVariable float64 0 296 | CountDeclMethod float64 0 599 | CountDeclMethodAll float64 0 1.12k | CountLine float64 1 40.4k | CountLineBlank float64 0 8.16k | CountLineCode float64 1 25.7k | CountLineCodeDecl float64 1 8.15k | CountLineCodeExe float64 0 24.2k | CountLineComment float64 0 16.5k | CountStmt float64 1 9.71k | CountStmtDecl float64 1 8.15k | CountStmtExe float64 0 9.69k | MaxCyclomatic float64 0 759 | MaxInheritanceTree float64 0 16 | MaxNesting float64 0 34 | SumCyclomatic float64 0 2.9k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6,400 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/optimization.py | transformers.optimization.Adafactor | import torch
import math
from torch.optim import Optimizer
class Adafactor(Optimizer):
"""
AdaFactor pytorch implementation can be used as a drop in replacement for Adam original fairseq code:
https://github.com/pytorch/fairseq/blob/master/fairseq/optim/adafactor.py
Paper: *Adafactor: Adaptive Learnin... |
class Adafactor(Optimizer):
'''
AdaFactor pytorch implementation can be used as a drop in replacement for Adam original fairseq code:
https://github.com/pytorch/fairseq/blob/master/fairseq/optim/adafactor.py
Paper: *Adafactor: Adaptive Learning Rates with Sublinear Memory Cost* https://huggingface.co/p... | 12 | 2 | 24 | 3 | 19 | 2 | 5 | 0.67 | 1 | 3 | 0 | 0 | 2 | 0 | 6 | 6 | 239 | 40 | 120 | 47 | 96 | 80 | 89 | 30 | 82 | 17 | 1 | 4 | 27 |
6,401 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/optimization.py | transformers.optimization.AdafactorSchedule | from torch.optim.lr_scheduler import LambdaLR, ReduceLROnPlateau
class AdafactorSchedule(LambdaLR):
"""
Since [`~optimization.Adafactor`] performs its own scheduling, if the training loop relies on a scheduler (e.g.,
for logging), this class creates a proxy object that retrieves the current lr values from ... |
class AdafactorSchedule(LambdaLR):
'''
Since [`~optimization.Adafactor`] performs its own scheduling, if the training loop relies on a scheduler (e.g.,
for logging), this class creates a proxy object that retrieves the current lr values from the optimizer.
It returns `initial_lr` during startup and the... | 4 | 1 | 7 | 0 | 7 | 0 | 2 | 0.32 | 1 | 1 | 0 | 0 | 2 | 0 | 2 | 14 | 28 | 4 | 19 | 7 | 15 | 6 | 15 | 7 | 11 | 3 | 2 | 1 | 6 |
6,402 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/audio_classification.py | transformers.pipelines.audio_classification.AudioClassificationPipeline | import numpy as np
from .base import Pipeline, build_pipeline_init_args
from typing import Any, Union
import requests
from ..utils import add_end_docstrings, is_torch_available, is_torchaudio_available, is_torchcodec_available, logging
@add_end_docstrings(build_pipeline_init_args(has_feature_extractor=True))
class Aud... | null | 8 | 2 | 25 | 3 | 15 | 6 | 4 | 0.59 | 1 | 8 | 0 | 0 | 6 | 0 | 6 | 48 | 178 | 31 | 93 | 22 | 80 | 55 | 69 | 17 | 60 | 12 | 6 | 3 | 26 |
6,403 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/automatic_speech_recognition.py | transformers.pipelines.automatic_speech_recognition.AutomaticSpeechRecognitionPipeline | import requests
from .base import ChunkPipeline
from .audio_utils import ffmpeg_read
from typing import TYPE_CHECKING, Any, Optional, Union
from ..generation import GenerationConfig
from ..tokenization_utils import PreTrainedTokenizer
from collections import defaultdict
import numpy as np
from ..utils import is_torch_a... |
class AutomaticSpeechRecognitionPipeline(ChunkPipeline):
'''
Pipeline that aims at extracting spoken text contained within some audio.
The input can be either a raw waveform or a audio file. In case of the audio file, ffmpeg should be installed for
to support multiple audio formats
Unless the model... | 7 | 2 | 77 | 6 | 57 | 14 | 14 | 0.4 | 1 | 13 | 1 | 0 | 6 | 2 | 6 | 50 | 534 | 58 | 340 | 86 | 307 | 136 | 224 | 60 | 216 | 23 | 7 | 5 | 82 |
6,404 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/base.py | transformers.pipelines.base.ArgumentHandler | from abc import ABC, abstractmethod
class ArgumentHandler(ABC):
"""
Base interface for handling arguments for each [`~pipelines.Pipeline`].
"""
@abstractmethod
def __call__(self, *args, **kwargs):
raise NotImplementedError() |
class ArgumentHandler(ABC):
'''
Base interface for handling arguments for each [`~pipelines.Pipeline`].
'''
@abstractmethod
def __call__(self, *args, **kwargs):
pass | 3 | 1 | 2 | 0 | 2 | 0 | 1 | 0.75 | 1 | 1 | 0 | 4 | 1 | 0 | 1 | 21 | 8 | 1 | 4 | 3 | 1 | 3 | 3 | 2 | 1 | 1 | 4 | 0 | 1 |
6,405 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/base.py | transformers.pipelines.base.ChunkPipeline | import os
class ChunkPipeline(Pipeline):
def run_single(self, inputs, preprocess_params, forward_params, postprocess_params):
all_outputs = []
for model_inputs in self.preprocess(inputs, **preprocess_params):
model_outputs = self.forward(model_inputs, **forward_params)
all_... |
class ChunkPipeline(Pipeline):
def run_single(self, inputs, preprocess_params, forward_params, postprocess_params):
pass
def get_iterator(self, inputs, num_workers: int, batch_size: int, preprocess_params, forward_params, postprocess_params):
pass | 3 | 0 | 14 | 1 | 13 | 1 | 4 | 0.04 | 1 | 4 | 0 | 7 | 2 | 1 | 2 | 44 | 30 | 2 | 27 | 15 | 22 | 1 | 22 | 13 | 19 | 5 | 6 | 1 | 7 |
6,406 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/base.py | transformers.pipelines.base.CsvPipelineDataFormat | from typing import TYPE_CHECKING, Any, Optional, Union
import csv
class CsvPipelineDataFormat(PipelineDataFormat):
"""
Support for pipelines using CSV data format.
Args:
output_path (`str`): Where to save the outgoing data.
input_path (`str`): Where to look for the input data.
colu... |
class CsvPipelineDataFormat(PipelineDataFormat):
'''
Support for pipelines using CSV data format.
Args:
output_path (`str`): Where to save the outgoing data.
input_path (`str`): Where to look for the input data.
column (`str`): The column to read.
overwrite (`bool`, *optiona... | 4 | 2 | 9 | 0 | 7 | 2 | 2 | 0.61 | 1 | 6 | 0 | 0 | 3 | 0 | 3 | 8 | 42 | 5 | 23 | 15 | 13 | 14 | 16 | 7 | 12 | 3 | 1 | 3 | 6 |
6,407 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/base.py | transformers.pipelines.base.JsonPipelineDataFormat | import json
from typing import TYPE_CHECKING, Any, Optional, Union
class JsonPipelineDataFormat(PipelineDataFormat):
"""
Support for pipelines using JSON file format.
Args:
output_path (`str`): Where to save the outgoing data.
input_path (`str`): Where to look for the input data.
c... |
class JsonPipelineDataFormat(PipelineDataFormat):
'''
Support for pipelines using JSON file format.
Args:
output_path (`str`): Where to save the outgoing data.
input_path (`str`): Where to look for the input data.
column (`str`): The column to read.
overwrite (`bool`, *optio... | 4 | 2 | 9 | 1 | 6 | 2 | 2 | 0.7 | 1 | 3 | 0 | 0 | 3 | 1 | 3 | 8 | 40 | 6 | 20 | 14 | 10 | 14 | 13 | 6 | 9 | 3 | 1 | 2 | 5 |
6,408 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/base.py | transformers.pipelines.base.PipedPipelineDataFormat | import sys
from typing import TYPE_CHECKING, Any, Optional, Union
class PipedPipelineDataFormat(PipelineDataFormat):
"""
Read data from piped input to the python process. For multi columns data, columns should separated by
If columns are provided, then the output will be a dictionary with {column_x: val... |
class PipedPipelineDataFormat(PipelineDataFormat):
'''
Read data from piped input to the python process. For multi columns data, columns should separated by
If columns are provided, then the output will be a dictionary with {column_x: value_x}
Args:
output_path (`str`): Where to save the o... | 4 | 2 | 10 | 1 | 6 | 3 | 2 | 0.9 | 1 | 6 | 0 | 0 | 3 | 0 | 3 | 8 | 46 | 8 | 20 | 6 | 16 | 18 | 15 | 5 | 11 | 4 | 1 | 3 | 7 |
6,409 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/base.py | transformers.pipelines.base.Pipeline | import types
from collections import UserDict
from typing import TYPE_CHECKING, Any, Optional, Union
from ..modelcard import ModelCard
from ..processing_utils import ProcessorMixin
from abc import ABC, abstractmethod
import os
from contextlib import contextmanager
import copy
from ..feature_extraction_utils import PreT... | @add_end_docstrings(build_pipeline_init_args(has_tokenizer=True, has_feature_extractor=True, has_image_processor=True, has_processor=True))
class Pipeline(_ScikitCompat, PushToHubMixin):
'''
The Pipeline class is the class from which all pipelines inherit. Refer to this class for methods shared across
diffe... | 30 | 13 | 23 | 2 | 16 | 5 | 5 | 0.35 | 2 | 23 | 6 | 21 | 20 | 20 | 20 | 42 | 518 | 64 | 338 | 103 | 289 | 117 | 233 | 75 | 212 | 28 | 5 | 4 | 95 |
6,410 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/base.py | transformers.pipelines.base.PipelineDataFormat | import os
from os.path import abspath, exists
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, Optional, Union
import pickle
class PipelineDataFormat:
"""
Base class for all the pipeline supported data format both for reading and writing. Supported data formats
currently includes:... |
class PipelineDataFormat:
'''
Base class for all the pipeline supported data format both for reading and writing. Supported data formats
currently includes:
- JSON
- CSV
- stdin/stdout (pipe)
`PipelineDataFormat` also includes some utilities to work with multi-columns like mapping from data... | 9 | 4 | 16 | 2 | 9 | 6 | 3 | 0.88 | 0 | 10 | 3 | 3 | 4 | 4 | 5 | 5 | 111 | 19 | 49 | 29 | 28 | 43 | 31 | 13 | 25 | 8 | 0 | 2 | 15 |
6,411 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/base.py | transformers.pipelines.base.PipelineException | class PipelineException(Exception):
"""
Raised by a [`Pipeline`] when handling __call__.
Args:
task (`str`): The task of the pipeline.
model (`str`): The model used by the pipeline.
reason (`str`): The error message to display.
"""
def __init__(self, task: str, model: str, ... | class PipelineException(Exception):
'''
Raised by a [`Pipeline`] when handling __call__.
Args:
task (`str`): The task of the pipeline.
model (`str`): The model used by the pipeline.
reason (`str`): The error message to display.
'''
def __init__(self, task: str, model: str, r... | 2 | 1 | 5 | 1 | 4 | 0 | 1 | 1.4 | 1 | 2 | 0 | 0 | 1 | 2 | 1 | 11 | 15 | 3 | 5 | 4 | 3 | 7 | 5 | 4 | 3 | 1 | 3 | 0 | 1 |
6,412 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/base.py | transformers.pipelines.base.PipelineRegistry | from typing import TYPE_CHECKING, Any, Optional, Union
class PipelineRegistry:
def __init__(self, supported_tasks: dict[str, Any], task_aliases: dict[str, str]) -> None:
self.supported_tasks = supported_tasks
self.task_aliases = task_aliases
def get_supported_tasks(self) -> list[str]:
... |
class PipelineRegistry:
def __init__(self, supported_tasks: dict[str, Any], task_aliases: dict[str, str]) -> None:
pass
def get_supported_tasks(self) -> list[str]:
pass
def check_task(self, task: str) -> tuple[str, dict, Any]:
pass
def register_pipeline(self, task: str, pipe... | 6 | 0 | 12 | 2 | 11 | 0 | 3 | 0 | 0 | 5 | 0 | 0 | 5 | 2 | 5 | 5 | 66 | 12 | 54 | 20 | 40 | 0 | 42 | 12 | 36 | 9 | 0 | 2 | 17 |
6,413 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/base.py | transformers.pipelines.base._ScikitCompat | from abc import ABC, abstractmethod
class _ScikitCompat(ABC):
"""
Interface layer for the Scikit and Keras compatibility.
"""
@abstractmethod
def transform(self, X):
raise NotImplementedError()
@abstractmethod
def predict(self, X):
raise NotImplementedError() |
class _ScikitCompat(ABC):
'''
Interface layer for the Scikit and Keras compatibility.
'''
@abstractmethod
def transform(self, X):
pass
@abstractmethod
def predict(self, X):
pass | 5 | 1 | 2 | 0 | 2 | 0 | 1 | 0.43 | 1 | 1 | 0 | 1 | 2 | 0 | 2 | 22 | 12 | 2 | 7 | 5 | 2 | 3 | 5 | 3 | 2 | 1 | 4 | 0 | 2 |
6,414 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/depth_estimation.py | transformers.pipelines.depth_estimation.DepthEstimationPipeline | from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends
from typing import Any, Union, overload
from .base import Pipeline, build_pipeline_init_args
@add_end_docstrings(build_pipeline_init_args(has_image_processor=True))
class DepthEstimationPipeline(Pipeline):
"... | @add_end_docstrings(build_pipeline_init_args(has_image_processor=True))
class DepthEstimationPipeline(Pipeline):
'''
Depth estimation pipeline using any `AutoModelForDepthEstimation`. This pipeline predicts the depth of an image.
Example:
```python
>>> from transformers import pipeline
>>> depth... | 12 | 2 | 13 | 2 | 7 | 5 | 2 | 1.07 | 1 | 4 | 0 | 0 | 6 | 0 | 6 | 48 | 109 | 22 | 42 | 15 | 35 | 45 | 39 | 15 | 32 | 3 | 6 | 1 | 13 |
6,415 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/document_question_answering.py | transformers.pipelines.document_question_answering.DocumentQuestionAnsweringPipeline | from ..utils import ExplicitEnum, add_end_docstrings, is_pytesseract_available, is_torch_available, is_vision_available, logging
import re
from typing import Any, Optional, Union, overload
from ..generation import GenerationConfig
import numpy as np
from .question_answering import select_starts_ends
from .base import C... | @add_end_docstrings(build_pipeline_init_args(has_image_processor=True, has_tokenizer=True))
class DocumentQuestionAnsweringPipeline(ChunkPipeline):
'''
Document Question Answering pipeline using any `AutoModelForDocumentQuestionAnswering`. The inputs/outputs are
similar to the (extractive) question answerin... | 16 | 2 | 48 | 4 | 35 | 9 | 8 | 0.34 | 1 | 8 | 1 | 0 | 8 | 1 | 8 | 52 | 420 | 46 | 281 | 77 | 241 | 96 | 171 | 46 | 162 | 28 | 7 | 5 | 66 |
6,416 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/document_question_answering.py | transformers.pipelines.document_question_answering.ModelType | from ..utils import ExplicitEnum, add_end_docstrings, is_pytesseract_available, is_torch_available, is_vision_available, logging
class ModelType(ExplicitEnum):
LayoutLM = 'layoutlm'
LayoutLMv2andv3 = 'layoutlmv2andv3'
VisionEncoderDecoder = 'vision_encoder_decoder' |
class ModelType(ExplicitEnum):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 4 | 4 | 3 | 0 | 4 | 4 | 3 | 0 | 1 | 0 | 0 |
6,417 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/feature_extraction.py | transformers.pipelines.feature_extraction.FeatureExtractionPipeline | from .base import GenericTensor, Pipeline, build_pipeline_init_args
from ..utils import add_end_docstrings
from typing import Any, Union
@add_end_docstrings(build_pipeline_init_args(has_tokenizer=True, supports_binary_output=False), '\n tokenize_kwargs (`dict`, *optional*):\n Additional dictionar... | null | 7 | 2 | 9 | 1 | 6 | 2 | 2 | 0.83 | 1 | 3 | 0 | 0 | 5 | 0 | 5 | 47 | 72 | 17 | 30 | 10 | 24 | 25 | 27 | 10 | 21 | 5 | 6 | 2 | 12 |
6,418 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/fill_mask.py | transformers.pipelines.fill_mask.FillMaskPipeline | from .base import GenericTensor, Pipeline, PipelineException, build_pipeline_init_args
from ..utils import add_end_docstrings, is_torch_available, logging
from typing import Any, Union, overload
import numpy as np
@add_end_docstrings(build_pipeline_init_args(has_tokenizer=True), '\n top_k (`int`, *optional*, de... | null | 15 | 1 | 20 | 2 | 15 | 3 | 4 | 0.47 | 1 | 9 | 1 | 0 | 9 | 0 | 9 | 51 | 240 | 43 | 134 | 43 | 122 | 63 | 109 | 41 | 99 | 9 | 6 | 3 | 36 |
6,419 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/image_classification.py | transformers.pipelines.image_classification.ClassificationFunction | from ..utils import ExplicitEnum, add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends
class ClassificationFunction(ExplicitEnum):
SIGMOID = 'sigmoid'
SOFTMAX = 'softmax'
NONE = 'none' |
class ClassificationFunction(ExplicitEnum):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 4 | 4 | 3 | 0 | 4 | 4 | 3 | 0 | 1 | 0 | 0 |
6,420 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/image_classification.py | transformers.pipelines.image_classification.ImageClassificationPipeline | from ..utils import ExplicitEnum, add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends
from .base import Pipeline, build_pipeline_init_args
from typing import Any, Union, overload
@add_end_docstrings(build_pipeline_init_args(has_image_processor=True), '\n function_to_apply (`s... | @add_end_docstrings(build_pipeline_init_args(has_image_processor=True), '\n function_to_apply (`str`, *optional*, defaults to `"default"`):\n The function to apply to the model outputs in order to retrieve the scores. Accepts four different values:\n\n - `"default"`: if the model has a sing... | 12 | 2 | 20 | 3 | 11 | 6 | 4 | 0.77 | 1 | 5 | 1 | 0 | 6 | 0 | 6 | 48 | 150 | 28 | 69 | 15 | 62 | 53 | 56 | 15 | 49 | 11 | 6 | 2 | 24 |
6,421 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/image_feature_extraction.py | transformers.pipelines.image_feature_extraction.ImageFeatureExtractionPipeline | from typing import Any, Union
from .base import GenericTensor, Pipeline, build_pipeline_init_args
from ..utils import add_end_docstrings, is_vision_available
@add_end_docstrings(build_pipeline_init_args(has_image_processor=True), '\n image_processor_kwargs (`dict`, *optional*):\n Additional dicti... | null | 7 | 2 | 13 | 2 | 7 | 4 | 3 | 0.92 | 1 | 3 | 0 | 0 | 5 | 0 | 5 | 47 | 92 | 19 | 38 | 11 | 32 | 35 | 34 | 11 | 28 | 7 | 6 | 2 | 16 |
6,422 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/image_segmentation.py | transformers.pipelines.image_segmentation.ImageSegmentationPipeline | from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends
from .base import Pipeline, build_pipeline_init_args
import numpy as np
from typing import Any, Union, overload
@add_end_docstrings(build_pipeline_init_args(has_image_processor=True))
class ImageSegmentationPipe... | @add_end_docstrings(build_pipeline_init_args(has_image_processor=True))
class ImageSegmentationPipeline(Pipeline):
'''
Image segmentation pipeline using any `AutoModelForXXXSegmentation`. This pipeline predicts masks of objects and
their classes.
Example:
```python
>>> from transformers import p... | 12 | 2 | 25 | 3 | 16 | 6 | 4 | 0.61 | 1 | 2 | 0 | 0 | 6 | 0 | 6 | 48 | 190 | 31 | 99 | 26 | 90 | 60 | 79 | 24 | 72 | 7 | 6 | 2 | 24 |
6,423 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/image_text_to_text.py | transformers.pipelines.image_text_to_text.Chat | from typing import Any, Optional, Union, overload
class Chat:
"""This class is intended to just be used internally in this pipeline and not exposed to users. We convert chats
to this format because the rest of the pipeline code tends to assume that lists of messages are
actually a batch of samples rather t... |
class Chat:
'''This class is intended to just be used internally in this pipeline and not exposed to users. We convert chats
to this format because the rest of the pipeline code tends to assume that lists of messages are
actually a batch of samples rather than messages in the same conversation.'''
def... | 2 | 1 | 8 | 1 | 7 | 0 | 3 | 0.38 | 0 | 2 | 0 | 0 | 1 | 2 | 1 | 1 | 13 | 2 | 8 | 5 | 6 | 3 | 8 | 5 | 6 | 3 | 0 | 2 | 3 |
6,424 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/image_text_to_text.py | transformers.pipelines.image_text_to_text.ImageTextToTextPipeline | from ..generation import GenerationConfig
from .base import Pipeline, build_pipeline_init_args
from ..processing_utils import ProcessingKwargs, Unpack
from typing import Any, Optional, Union, overload
from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends
@add_end_d... | @add_end_docstrings(build_pipeline_init_args(has_processor=True))
class ImageTextToTextPipeline(Pipeline):
'''
Image-text-to-text pipeline using an `AutoModelForImageTextToText`. This pipeline generates text given an image and text.
When the underlying model is a conversational model, it can also accept one... | 13 | 2 | 42 | 4 | 27 | 11 | 7 | 0.66 | 1 | 12 | 4 | 0 | 6 | 1 | 6 | 48 | 318 | 40 | 169 | 52 | 145 | 111 | 115 | 34 | 108 | 13 | 6 | 4 | 44 |
6,425 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/image_to_image.py | transformers.pipelines.image_to_image.ImageToImagePipeline | import numpy as np
from typing import Any, Union, overload
from .base import Pipeline, build_pipeline_init_args
from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends
@add_end_docstrings(build_pipeline_init_args(has_image_processor=True))
class ImageToImagePipeline(... | @add_end_docstrings(build_pipeline_init_args(has_image_processor=True))
class ImageToImagePipeline(Pipeline):
'''
Image to Image pipeline using any `AutoModelForImageToImage`. This pipeline generates an image based on a previous
image input.
Example:
```python
>>> from PIL import Image
>>> i... | 12 | 2 | 10 | 1 | 6 | 3 | 2 | 1.11 | 1 | 2 | 0 | 0 | 6 | 0 | 6 | 48 | 97 | 20 | 37 | 17 | 28 | 41 | 35 | 15 | 28 | 4 | 6 | 1 | 12 |
6,426 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/image_to_text.py | transformers.pipelines.image_to_text.ImageToTextPipeline | from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends
from typing import Any, Union, overload
from ..generation import GenerationConfig
from .base import Pipeline, build_pipeline_init_args
@add_end_docstrings(build_pipeline_init_args(has_tokenizer=True, has_image_p... | @add_end_docstrings(build_pipeline_init_args(has_tokenizer=True, has_image_processor=True))
class ImageToTextPipeline(Pipeline):
'''
Image To Text pipeline using a `AutoModelForVision2Seq`. This pipeline predicts a caption for a given image.
Unless the model you're using explicitly sets these generation par... | 12 | 2 | 25 | 4 | 16 | 5 | 5 | 0.45 | 1 | 4 | 0 | 0 | 6 | 0 | 6 | 48 | 177 | 35 | 98 | 18 | 91 | 44 | 74 | 18 | 67 | 11 | 6 | 3 | 29 |
6,427 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/mask_generation.py | transformers.pipelines.mask_generation.MaskGenerationPipeline | from collections import defaultdict
from ..utils import add_end_docstrings, is_torch_available, logging, requires_backends
from .base import ChunkPipeline, build_pipeline_init_args
from typing import TYPE_CHECKING, Any, Optional, Union, overload
from ..image_utils import load_image
@add_end_docstrings(build_pipeline_i... | @add_end_docstrings(build_pipeline_init_args(has_image_processor=True), '\n points_per_batch (*optional*, int, default to 64):\n Sets the number of points run simultaneously by the model. Higher numbers may be faster but use more GPU\n memory.\n output_bboxes_mask (`bool`, *optional*... | 12 | 2 | 33 | 3 | 24 | 6 | 5 | 0.52 | 1 | 6 | 0 | 0 | 6 | 0 | 6 | 50 | 255 | 32 | 147 | 60 | 118 | 76 | 96 | 38 | 89 | 14 | 7 | 3 | 30 |
6,428 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/object_detection.py | transformers.pipelines.object_detection.ObjectDetectionPipeline | from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends
from typing import TYPE_CHECKING, Any, Union, overload
from .base import Pipeline, build_pipeline_init_args
@add_end_docstrings(build_pipeline_init_args(has_image_processor=True))
class ObjectDetectionPipeline(P... | @add_end_docstrings(build_pipeline_init_args(has_image_processor=True))
class ObjectDetectionPipeline(Pipeline):
'''
Object detection pipeline using any `AutoModelForObjectDetection`. This pipeline predicts bounding boxes of objects
and their classes.
Example:
```python
>>> from transformers imp... | 14 | 3 | 18 | 2 | 12 | 5 | 2 | 0.62 | 1 | 7 | 0 | 0 | 7 | 0 | 7 | 49 | 165 | 29 | 84 | 28 | 75 | 52 | 66 | 28 | 57 | 3 | 6 | 1 | 17 |
6,429 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/pt_utils.py | transformers.pipelines.pt_utils.KeyDataset | from torch.utils.data import Dataset, IterableDataset
class KeyDataset(Dataset):
def __init__(self, dataset: Dataset, key: str):
self.dataset = dataset
self.key = key
def __len__(self):
return len(self.dataset)
def __getitem__(self, i):
return self.dataset[i][self.key] |
class KeyDataset(Dataset):
def __init__(self, dataset: Dataset, key: str):
pass
def __len__(self):
pass
def __getitem__(self, i):
pass | 4 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 3 | 2 | 3 | 3 | 10 | 2 | 8 | 6 | 4 | 0 | 8 | 6 | 4 | 1 | 1 | 0 | 3 |
6,430 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/pt_utils.py | transformers.pipelines.pt_utils.KeyPairDataset | from torch.utils.data import Dataset, IterableDataset
class KeyPairDataset(Dataset):
def __init__(self, dataset: Dataset, key1: str, key2: str):
self.dataset = dataset
self.key1 = key1
self.key2 = key2
def __len__(self):
return len(self.dataset)
def __getitem__(self, i):
... |
class KeyPairDataset(Dataset):
def __init__(self, dataset: Dataset, key1: str, key2: str):
pass
def __len__(self):
pass
def __getitem__(self, i):
pass | 4 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 3 | 3 | 3 | 3 | 11 | 2 | 9 | 7 | 5 | 0 | 9 | 7 | 5 | 1 | 1 | 0 | 3 |
6,431 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/pt_utils.py | transformers.pipelines.pt_utils.PipelineChunkIterator | class PipelineChunkIterator(PipelineIterator):
def __init__(self, loader, infer, params, loader_batch_size=None):
"""
Roughly equivalent to
```
for iterator in loader:
for item in iterator:
yield infer(item, **params)
```
Argumen... | class PipelineChunkIterator(PipelineIterator):
def __init__(self, loader, infer, params, loader_batch_size=None):
'''
Roughly equivalent to
```
for iterator in loader:
for item in iterator:
yield infer(item, **params)
```
Arguments... | 4 | 1 | 13 | 1 | 5 | 8 | 2 | 1.44 | 1 | 2 | 0 | 0 | 3 | 2 | 3 | 13 | 43 | 4 | 16 | 7 | 12 | 23 | 16 | 7 | 12 | 3 | 4 | 1 | 5 |
6,432 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/pt_utils.py | transformers.pipelines.pt_utils.PipelineDataset | from torch.utils.data import Dataset, IterableDataset
class PipelineDataset(Dataset):
def __init__(self, dataset, process, params):
self.dataset = dataset
self.process = process
self.params = params
def __len__(self):
return len(self.dataset)
def __getitem__(self, i):
... |
class PipelineDataset(Dataset):
def __init__(self, dataset, process, params):
pass
def __len__(self):
pass
def __getitem__(self, i):
pass | 4 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 3 | 3 | 3 | 3 | 13 | 2 | 11 | 9 | 7 | 0 | 11 | 9 | 7 | 1 | 1 | 0 | 3 |
6,433 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/pt_utils.py | transformers.pipelines.pt_utils.PipelineIterator | import torch
import numpy as np
from torch.utils.data import Dataset, IterableDataset
from ..utils.generic import ModelOutput
class PipelineIterator(IterableDataset):
def __init__(self, loader, infer, params, loader_batch_size=None):
"""
Roughly equivalent to
```
for item in loade... |
class PipelineIterator(IterableDataset):
def __init__(self, loader, infer, params, loader_batch_size=None):
'''
Roughly equivalent to
```
for item in loader:
yield infer(item, **params)
```
Arguments:
loader (`torch.utils.data... | 6 | 2 | 25 | 2 | 14 | 10 | 5 | 0.7 | 1 | 4 | 1 | 2 | 5 | 7 | 5 | 10 | 129 | 12 | 69 | 21 | 63 | 48 | 59 | 21 | 53 | 12 | 3 | 4 | 24 |
6,434 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/pt_utils.py | transformers.pipelines.pt_utils.PipelinePackIterator | import torch
class PipelinePackIterator(PipelineIterator):
"""
Roughly equivalent to
```
packed = []
for item in loader:
packed.append(item)
if item["is_last"]:
yield packed
packed = []
```
but it also handles cases where `item` are batched (me... |
class PipelinePackIterator(PipelineIterator):
'''
Roughly equivalent to
```
packed = []
for item in loader:
packed.append(item)
if item["is_last"]:
yield packed
packed = []
```
but it also handles cases where `item` are batched (meaning it's a di... | 3 | 1 | 26 | 1 | 20 | 5 | 6 | 1.15 | 1 | 2 | 0 | 0 | 2 | 4 | 2 | 12 | 98 | 10 | 41 | 14 | 38 | 47 | 38 | 14 | 35 | 11 | 4 | 4 | 12 |
6,435 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/question_answering.py | transformers.pipelines.question_answering.QuestionAnsweringArgumentHandler | import warnings
from ..data import SquadExample, SquadFeatures, squad_convert_examples_to_features
from .base import ArgumentHandler, ChunkPipeline, build_pipeline_init_args
import types
from collections.abc import Iterable
class QuestionAnsweringArgumentHandler(ArgumentHandler):
"""
QuestionAnsweringPipeline ... |
class QuestionAnsweringArgumentHandler(ArgumentHandler):
'''
QuestionAnsweringPipeline requires the user to provide multiple arguments (i.e. question & context) to be mapped to
internal [`SquadExample`].
QuestionAnsweringArgumentHandler manages all the possible to create a [`SquadExample`] from the com... | 3 | 1 | 35 | 3 | 29 | 3 | 12 | 0.2 | 1 | 11 | 2 | 0 | 2 | 0 | 2 | 23 | 80 | 9 | 59 | 7 | 56 | 12 | 39 | 7 | 36 | 16 | 5 | 3 | 23 |
6,436 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/question_answering.py | transformers.pipelines.question_answering.QuestionAnsweringPipeline | from ..tokenization_utils import PreTrainedTokenizer
import numpy as np
from ..modelcard import ModelCard
import warnings
from typing import TYPE_CHECKING, Optional, Union
import inspect
from ..utils import PaddingStrategy, add_end_docstrings, is_tokenizers_available, is_torch_available, logging
from .base import Argum... | @add_end_docstrings(build_pipeline_init_args(has_tokenizer=True))
class QuestionAnsweringPipeline(ChunkPipeline):
'''
Question Answering pipeline using any `ModelForQuestionAnswering`. See the [question answering
examples](../task_summary#question-answering) for more information.
Example:
```python
... | 13 | 4 | 46 | 4 | 32 | 10 | 7 | 0.38 | 1 | 19 | 5 | 0 | 8 | 2 | 9 | 53 | 450 | 52 | 290 | 98 | 248 | 109 | 166 | 65 | 156 | 22 | 7 | 5 | 67 |
6,437 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/table_question_answering.py | transformers.pipelines.table_question_answering.TableQuestionAnsweringArgumentHandler | from ..utils import add_end_docstrings, is_torch_available, requires_backends
from .base import ArgumentHandler, Dataset, Pipeline, PipelineException, build_pipeline_init_args
import types
class TableQuestionAnsweringArgumentHandler(ArgumentHandler):
"""
Handles arguments for the TableQuestionAnsweringPipeline... |
class TableQuestionAnsweringArgumentHandler(ArgumentHandler):
'''
Handles arguments for the TableQuestionAnsweringPipeline
'''
def __call__(self, table=None, query=None, **kwargs):
pass | 2 | 1 | 46 | 5 | 35 | 6 | 11 | 0.25 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 22 | 51 | 6 | 36 | 5 | 33 | 9 | 22 | 5 | 19 | 11 | 5 | 3 | 11 |
6,438 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/table_question_answering.py | transformers.pipelines.table_question_answering.TableQuestionAnsweringPipeline | import collections
from ..generation import GenerationConfig
import numpy as np
from .base import ArgumentHandler, Dataset, Pipeline, PipelineException, build_pipeline_init_args
from ..utils import add_end_docstrings, is_torch_available, requires_backends
@add_end_docstrings(build_pipeline_init_args(has_tokenizer=True... | @add_end_docstrings(build_pipeline_init_args(has_tokenizer=True))
class TableQuestionAnsweringPipeline(Pipeline):
'''
Table Question Answering pipeline using a `ModelForTableQuestionAnswering`. This pipeline is only available in
PyTorch.
Unless the model you're using explicitly sets these generation par... | 10 | 3 | 40 | 7 | 25 | 10 | 6 | 0.51 | 1 | 11 | 2 | 0 | 8 | 4 | 8 | 50 | 358 | 68 | 199 | 64 | 190 | 101 | 172 | 64 | 163 | 18 | 6 | 5 | 46 |
6,439 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/text2text_generation.py | transformers.pipelines.text2text_generation.ReturnType | import enum
class ReturnType(enum.Enum):
TENSORS = 0
TEXT = 1 |
class ReturnType(enum.Enum):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 49 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 4 | 0 | 0 |
6,440 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/text2text_generation.py | transformers.pipelines.text2text_generation.SummarizationPipeline | from ..utils import add_end_docstrings, is_torch_available, logging
from .base import Pipeline, build_pipeline_init_args
@add_end_docstrings(build_pipeline_init_args(has_tokenizer=True))
class SummarizationPipeline(Text2TextGenerationPipeline):
"""
Summarize news articles and other documents.
This summari... | @add_end_docstrings(build_pipeline_init_args(has_tokenizer=True))
class SummarizationPipeline(Text2TextGenerationPipeline):
'''
Summarize news articles and other documents.
This summarizing pipeline can currently be loaded from [`pipeline`] using the following task identifier:
`"summarization"`.
The... | 4 | 3 | 19 | 2 | 6 | 12 | 2 | 3.23 | 1 | 3 | 0 | 0 | 2 | 0 | 2 | 52 | 67 | 12 | 13 | 4 | 10 | 42 | 9 | 4 | 6 | 3 | 7 | 1 | 4 |
6,441 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/text2text_generation.py | transformers.pipelines.text2text_generation.Text2TextGenerationPipeline | from .base import Pipeline, build_pipeline_init_args
from ..tokenization_utils import TruncationStrategy
import warnings
from typing import Any, Union
from ..generation import GenerationConfig
from ..utils import add_end_docstrings, is_torch_available, logging
@add_end_docstrings(build_pipeline_init_args(has_tokenizer... | @add_end_docstrings(build_pipeline_init_args(has_tokenizer=True))
class Text2TextGenerationPipeline(Pipeline):
'''
Pipeline for text to text generation using seq2seq models.
Unless the model you're using explicitly sets these generation parameters in its configuration files
(`generation_config.json`), t... | 10 | 3 | 19 | 2 | 14 | 4 | 4 | 0.52 | 1 | 7 | 2 | 2 | 8 | 0 | 8 | 50 | 199 | 32 | 110 | 33 | 92 | 57 | 73 | 24 | 64 | 10 | 6 | 2 | 32 |
6,442 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/text2text_generation.py | transformers.pipelines.text2text_generation.TranslationPipeline | from ..tokenization_utils import TruncationStrategy
from ..utils import add_end_docstrings, is_torch_available, logging
from .base import Pipeline, build_pipeline_init_args
@add_end_docstrings(build_pipeline_init_args(has_tokenizer=True))
class TranslationPipeline(Text2TextGenerationPipeline):
"""
Translates f... | @add_end_docstrings(build_pipeline_init_args(has_tokenizer=True))
class TranslationPipeline(Text2TextGenerationPipeline):
'''
Translates from one language to another.
This translation pipeline can currently be loaded from [`pipeline`] using the following task identifier:
`"translation_xx_to_yy"`.
Th... | 6 | 2 | 15 | 1 | 7 | 7 | 3 | 1.35 | 1 | 3 | 1 | 0 | 4 | 1 | 4 | 54 | 85 | 12 | 31 | 10 | 26 | 42 | 25 | 9 | 20 | 5 | 7 | 2 | 10 |
6,443 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/text_classification.py | transformers.pipelines.text_classification.ClassificationFunction | from ..utils import ExplicitEnum, add_end_docstrings, is_torch_available
class ClassificationFunction(ExplicitEnum):
SIGMOID = 'sigmoid'
SOFTMAX = 'softmax'
NONE = 'none' |
class ClassificationFunction(ExplicitEnum):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 4 | 4 | 3 | 0 | 4 | 4 | 3 | 0 | 1 | 0 | 0 |
6,444 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/text_classification.py | transformers.pipelines.text_classification.TextClassificationPipeline | import warnings
import inspect
from .base import GenericTensor, Pipeline, build_pipeline_init_args
from ..utils import ExplicitEnum, add_end_docstrings, is_torch_available
from typing import Any, Union
@add_end_docstrings(build_pipeline_init_args(has_tokenizer=True), '\n return_all_scores (`bool`, *optional*, d... | @add_end_docstrings(build_pipeline_init_args(has_tokenizer=True), '\n return_all_scores (`bool`, *optional*, defaults to `False`):\n Whether to return all prediction scores or just the one of the predicted class.\n function_to_apply (`str`, *optional*, defaults to `"default"`):\n The... | 8 | 2 | 25 | 3 | 15 | 6 | 5 | 0.63 | 1 | 9 | 1 | 0 | 6 | 0 | 6 | 48 | 188 | 33 | 95 | 18 | 88 | 60 | 67 | 18 | 60 | 13 | 6 | 2 | 31 |
6,445 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/text_generation.py | transformers.pipelines.text_generation.Chat | class Chat:
"""This class is intended to just be used internally in this pipeline and not exposed to users. We convert chats
to this format because the rest of the pipeline code tends to assume that lists of messages are
actually a batch of samples rather than messages in the same conversation."""
def ... | class Chat:
'''This class is intended to just be used internally in this pipeline and not exposed to users. We convert chats
to this format because the rest of the pipeline code tends to assume that lists of messages are
actually a batch of samples rather than messages in the same conversation.'''
def ... | 2 | 1 | 5 | 0 | 5 | 0 | 3 | 0.5 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 10 | 1 | 6 | 4 | 4 | 3 | 6 | 4 | 4 | 3 | 0 | 2 | 3 |
6,446 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/text_generation.py | transformers.pipelines.text_generation.ReturnType | import enum
class ReturnType(enum.Enum):
TENSORS = 0
NEW_TEXT = 1
FULL_TEXT = 2 |
class ReturnType(enum.Enum):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 49 | 4 | 0 | 4 | 4 | 3 | 0 | 4 | 4 | 3 | 0 | 4 | 0 | 0 |
6,447 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/text_generation.py | transformers.pipelines.text_generation.TextGenerationPipeline | from ..generation import GenerationConfig
from ..utils import ModelOutput, add_end_docstrings, is_torch_available
from .base import Pipeline, build_pipeline_init_args
import types
import itertools
from typing import Any, overload
@add_end_docstrings(build_pipeline_init_args(has_tokenizer=True))
class TextGenerationPip... | null | 17 | 3 | 56 | 5 | 42 | 10 | 12 | 0.34 | 1 | 11 | 3 | 0 | 7 | 2 | 7 | 49 | 456 | 51 | 303 | 84 | 264 | 104 | 193 | 53 | 185 | 22 | 6 | 5 | 81 |
6,448 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/text_to_audio.py | transformers.pipelines.text_to_audio.TextToAudioPipeline | from typing import Any, Union, overload
from ..generation import GenerationConfig
from .base import Pipeline
class TextToAudioPipeline(Pipeline):
"""
Text-to-audio generation pipeline using any `AutoModelForTextToWaveform` or `AutoModelForTextToSpectrogram`. This
pipeline generates an audio file from an in... |
class TextToAudioPipeline(Pipeline):
'''
Text-to-audio generation pipeline using any `AutoModelForTextToWaveform` or `AutoModelForTextToSpectrogram`. This
pipeline generates an audio file from an input text and optional other conditional inputs.
Unless the model you're using explicitly sets these gener... | 11 | 2 | 23 | 4 | 15 | 4 | 5 | 0.64 | 1 | 6 | 1 | 0 | 6 | 2 | 6 | 48 | 193 | 45 | 90 | 25 | 78 | 58 | 66 | 20 | 59 | 9 | 6 | 3 | 27 |
6,449 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/token_classification.py | transformers.pipelines.token_classification.AggregationStrategy | from ..utils import ExplicitEnum, add_end_docstrings, is_torch_available
class AggregationStrategy(ExplicitEnum):
"""All the valid aggregation strategies for TokenClassificationPipeline"""
NONE = 'none'
SIMPLE = 'simple'
FIRST = 'first'
AVERAGE = 'average'
MAX = 'max' |
class AggregationStrategy(ExplicitEnum):
'''All the valid aggregation strategies for TokenClassificationPipeline'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 1 | 6 | 6 | 5 | 1 | 6 | 6 | 5 | 0 | 1 | 0 | 0 |
6,450 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/token_classification.py | transformers.pipelines.token_classification.TokenClassificationArgumentHandler | import types
from .base import ArgumentHandler, ChunkPipeline, Dataset, build_pipeline_init_args
from typing import Any, Optional, Union, overload
class TokenClassificationArgumentHandler(ArgumentHandler):
"""
Handles arguments for token classification.
"""
def __call__(self, inputs: Union[str, list[s... |
class TokenClassificationArgumentHandler(ArgumentHandler):
'''
Handles arguments for token classification.
'''
def __call__(self, inputs: Union[str, list[str]], **kwargs):
pass | 2 | 1 | 19 | 1 | 18 | 0 | 7 | 0.16 | 1 | 4 | 0 | 0 | 1 | 0 | 1 | 22 | 24 | 2 | 19 | 4 | 17 | 3 | 16 | 4 | 14 | 7 | 5 | 2 | 7 |
6,451 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/token_classification.py | transformers.pipelines.token_classification.TokenClassificationPipeline | import warnings
from ..utils import ExplicitEnum, add_end_docstrings, is_torch_available
from ..models.bert.tokenization_bert import BasicTokenizer
from .base import ArgumentHandler, ChunkPipeline, Dataset, build_pipeline_init_args
from typing import Any, Optional, Union, overload
import numpy as np
@add_end_docstring... | @add_end_docstrings(build_pipeline_init_args(has_tokenizer=True), '\n ignore_labels (`list[str]`, defaults to `["O"]`):\n A list of labels to ignore.\n grouped_entities (`bool`, *optional*, defaults to `False`):\n DEPRECATED, use `aggregation_strategy` instead. Whether or not to grou... | 20 | 6 | 30 | 2 | 24 | 4 | 5 | 0.24 | 1 | 12 | 3 | 0 | 14 | 3 | 14 | 58 | 477 | 53 | 342 | 104 | 311 | 82 | 216 | 87 | 201 | 15 | 7 | 4 | 74 |
6,452 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/video_classification.py | transformers.pipelines.video_classification.VideoClassificationPipeline | import requests
from ..utils import add_end_docstrings, is_av_available, is_torch_available, logging, requires_backends
from typing import Any, Optional, Union, overload
from io import BytesIO
import warnings
from .base import Pipeline, build_pipeline_init_args
@add_end_docstrings(build_pipeline_init_args(has_image_pr... | null | 12 | 2 | 19 | 2 | 11 | 5 | 3 | 0.59 | 1 | 6 | 0 | 0 | 6 | 0 | 6 | 48 | 130 | 22 | 68 | 17 | 61 | 40 | 58 | 17 | 51 | 6 | 6 | 2 | 20 |
6,453 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/visual_question_answering.py | transformers.pipelines.visual_question_answering.VisualQuestionAnsweringPipeline | from .base import Pipeline, build_pipeline_init_args
from typing import Optional, Union
from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging
from ..generation import GenerationConfig
@add_end_docstrings(build_pipeline_init_args(has_tokenizer=True, has_image_processor=True))
class Vi... | @add_end_docstrings(build_pipeline_init_args(has_tokenizer=True, has_image_processor=True))
class VisualQuestionAnsweringPipeline(Pipeline):
'''
Visual Question Answering pipeline using a `AutoModelForVisualQuestionAnswering`. This pipeline is currently only
available in PyTorch.
Unless the model you're... | 8 | 2 | 24 | 2 | 14 | 8 | 4 | 0.82 | 1 | 6 | 1 | 0 | 6 | 1 | 6 | 48 | 181 | 28 | 84 | 27 | 72 | 69 | 64 | 21 | 57 | 7 | 6 | 3 | 24 |
6,454 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/zero_shot_audio_classification.py | transformers.pipelines.zero_shot_audio_classification.ZeroShotAudioClassificationPipeline | import requests
from collections import UserDict
from typing import Any, Union
from .base import Pipeline, build_pipeline_init_args
import numpy as np
from ..utils import add_end_docstrings, logging
from .audio_classification import ffmpeg_read
@add_end_docstrings(build_pipeline_init_args(has_feature_extractor=True, h... | @add_end_docstrings(build_pipeline_init_args(has_feature_extractor=True, has_tokenizer=True))
class ZeroShotAudioClassificationPipeline(Pipeline):
'''
Zero shot audio classification pipeline using `ClapModel`. This pipeline predicts the class of an audio when you
provide an audio and a set of `candidate_lab... | 8 | 2 | 16 | 2 | 10 | 4 | 3 | 0.73 | 1 | 7 | 0 | 0 | 6 | 1 | 6 | 48 | 132 | 23 | 63 | 21 | 56 | 46 | 52 | 20 | 45 | 7 | 6 | 3 | 17 |
6,455 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/zero_shot_classification.py | transformers.pipelines.zero_shot_classification.ZeroShotClassificationArgumentHandler | from .base import ArgumentHandler, ChunkPipeline, build_pipeline_init_args
class ZeroShotClassificationArgumentHandler(ArgumentHandler):
"""
Handles arguments for zero-shot for text classification by turning each possible label into an NLI
premise/hypothesis pair.
"""
def _parse_labels(self, label... |
class ZeroShotClassificationArgumentHandler(ArgumentHandler):
'''
Handles arguments for zero-shot for text classification by turning each possible label into an NLI
premise/hypothesis pair.
'''
def _parse_labels(self, labels):
pass
def __call__(self, sequences, labels, hypothesis_temp... | 3 | 1 | 12 | 2 | 10 | 0 | 4 | 0.19 | 1 | 2 | 0 | 0 | 2 | 0 | 2 | 23 | 30 | 5 | 21 | 5 | 18 | 4 | 16 | 5 | 13 | 5 | 5 | 1 | 7 |
6,456 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/zero_shot_classification.py | transformers.pipelines.zero_shot_classification.ZeroShotClassificationPipeline | from typing import Union
import numpy as np
from ..utils import add_end_docstrings, logging
from ..tokenization_utils import TruncationStrategy
import inspect
from .base import ArgumentHandler, ChunkPipeline, build_pipeline_init_args
@add_end_docstrings(build_pipeline_init_args(has_tokenizer=True))
class ZeroShotClass... | null | 11 | 3 | 22 | 2 | 15 | 5 | 3 | 0.55 | 1 | 10 | 2 | 0 | 8 | 1 | 8 | 52 | 222 | 28 | 125 | 46 | 108 | 69 | 77 | 37 | 68 | 5 | 7 | 2 | 26 |
6,457 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/zero_shot_image_classification.py | transformers.pipelines.zero_shot_image_classification.ZeroShotImageClassificationPipeline | from typing import Any, Union, overload
from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends
import warnings
from .base import Pipeline, build_pipeline_init_args
from collections import UserDict
@add_end_docstrings(build_pipeline_init_args(has_image_processor=True... | @add_end_docstrings(build_pipeline_init_args(has_image_processor=True))
class ZeroShotImageClassificationPipeline(Pipeline):
'''
Zero shot image classification pipeline using `CLIPModel`. This pipeline predicts the class of an image when you
provide an image and a set of `candidate_labels`.
Example:
... | 12 | 2 | 20 | 2 | 14 | 4 | 4 | 0.58 | 1 | 7 | 0 | 0 | 6 | 1 | 6 | 48 | 160 | 24 | 86 | 28 | 72 | 50 | 62 | 21 | 55 | 6 | 6 | 2 | 22 |
6,458 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pipelines/zero_shot_object_detection.py | transformers.pipelines.zero_shot_object_detection.ZeroShotObjectDetectionPipeline | from .base import ChunkPipeline, build_pipeline_init_args
from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends
from typing import Any, Optional, Union, overload
@add_end_docstrings(build_pipeline_init_args(has_image_processor=True))
class ZeroShotObjectDetectionPi... | @add_end_docstrings(build_pipeline_init_args(has_image_processor=True))
class ZeroShotObjectDetectionPipeline(ChunkPipeline):
'''
Zero shot object detection pipeline using `OwlViTForObjectDetection`. This pipeline predicts bounding boxes of
objects when you provide an image and a set of `candidate_labels`.
... | 13 | 3 | 25 | 4 | 13 | 8 | 3 | 0.9 | 1 | 10 | 0 | 0 | 7 | 0 | 7 | 51 | 213 | 40 | 91 | 38 | 78 | 82 | 66 | 33 | 58 | 4 | 7 | 2 | 21 |
6,459 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/processing_utils.py | transformers.processing_utils.AllKwargsForChatTemplate | from typing import Any, Optional, TypedDict, TypeVar, Union
class AllKwargsForChatTemplate(TypedDict, total=False):
processor_kwargs: ProcessingKwargs
mm_load_kwargs: ChatTemplateLoadKwargs
template_kwargs: ProcessorChatTemplateKwargs |
class AllKwargsForChatTemplate(TypedDict, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 3 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
6,460 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/processing_utils.py | transformers.processing_utils.AudioKwargs | from .tokenization_utils_base import PaddingStrategy, PreTokenizedInput, PreTrainedTokenizerBase, TextInput, TruncationStrategy
from typing import Any, Optional, TypedDict, TypeVar, Union
class AudioKwargs(TypedDict, total=False):
"""
Keyword arguments for audio processing.
Attributes:
sampling_ra... |
class AudioKwargs(TypedDict, total=False):
'''
Keyword arguments for audio processing.
Attributes:
sampling_rate (`int`, *optional*):
The sampling rate at which the `raw_speech` input was sampled.
raw_speech (`np.ndarray`, `list[float]`, `list[np.ndarray]`, `list[list[float]]`):... | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3.25 | 2 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 37 | 3 | 8 | 1 | 7 | 26 | 8 | 1 | 7 | 0 | 1 | 0 | 0 |
6,461 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/processing_utils.py | transformers.processing_utils.CommonKwargs | from .utils import AUDIO_TOKENIZER_NAME, CHAT_TEMPLATE_DIR, CHAT_TEMPLATE_FILE, LEGACY_PROCESSOR_CHAT_TEMPLATE_FILE, PROCESSOR_NAME, PushToHubMixin, TensorType, cached_file, copy_func, direct_transformers_import, download_url, is_offline_mode, is_remote_url, is_torch_available, list_repo_templates, logging
from typing ... |
class CommonKwargs(TypedDict, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
6,462 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/processing_utils.py | transformers.processing_utils.ImagesKwargs | from .image_utils import ChannelDimension, ImageInput, is_vision_available
from typing import Any, Optional, TypedDict, TypeVar, Union
class ImagesKwargs(TypedDict, total=False):
"""
Keyword arguments for image processing. For extended documentation, check the appropriate ImageProcessor
class methods and d... |
class ImagesKwargs(TypedDict, total=False):
'''
Keyword arguments for image processing. For extended documentation, check the appropriate ImageProcessor
class methods and docstrings.
Attributes:
do_resize (`bool`, *optional*):
Whether to resize the image.
size (`dict[str, in... | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2.18 | 2 | 0 | 0 | 12 | 0 | 0 | 0 | 0 | 56 | 2 | 17 | 1 | 16 | 37 | 17 | 1 | 16 | 0 | 1 | 0 | 0 |
6,463 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/processing_utils.py | transformers.processing_utils.ProcessingKwargs | from typing import Any, Optional, TypedDict, TypeVar, Union
class ProcessingKwargs(TypedDict, total=False):
"""
Base class for kwargs passing to processors.
In case a model has specific kwargs that are not present in the base class or default values for existing keys,
it should have its own `ModelProce... |
class ProcessingKwargs(TypedDict, total=False):
'''
Base class for kwargs passing to processors.
In case a model has specific kwargs that are not present in the base class or default values for existing keys,
it should have its own `ModelProcessorKwargs` class that inherits from `ProcessingKwargs` to p... | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1.81 | 6 | 0 | 0 | 37 | 0 | 0 | 0 | 0 | 53 | 8 | 16 | 6 | 15 | 29 | 6 | 6 | 5 | 0 | 2 | 0 | 0 |
6,464 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/processing_utils.py | transformers.processing_utils.ProcessorMixin | import warnings
import os
from .audio_utils import AudioInput, load_audio
from typing import Any, Optional, TypedDict, TypeVar, Union
from .tokenization_utils_base import PaddingStrategy, PreTokenizedInput, PreTrainedTokenizerBase, TextInput, TruncationStrategy
from .utils.chat_template_utils import render_jinja_templa... |
class ProcessorMixin(PushToHubMixin):
'''
This is a mixin used to provide saving/loading functionality for all processor classes.
'''
def __init__(self, *args, **kwargs):
pass
def __call__(self, images: Optional[ImageInput]=None, text: Optional[Union[TextInput, PreTokenizedInput, list... | 34 | 19 | 49 | 6 | 28 | 15 | 7 | 0.52 | 1 | 18 | 5 | 71 | 11 | 0 | 17 | 17 | 870 | 112 | 498 | 143 | 451 | 260 | 324 | 112 | 305 | 20 | 1 | 6 | 115 |
6,465 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/processing_utils.py | transformers.processing_utils.TextKwargs | from .tokenization_utils_base import PaddingStrategy, PreTokenizedInput, PreTrainedTokenizerBase, TextInput, TruncationStrategy
from typing import Any, Optional, TypedDict, TypeVar, Union
class TextKwargs(TypedDict, total=False):
"""
Keyword arguments for text processing. For extended documentation, check out ... |
class TextKwargs(TypedDict, total=False):
'''
Keyword arguments for text processing. For extended documentation, check out tokenization_utils_base methods and
docstrings associated.
Attributes:
add_special_tokens (`bool`, *optional*)
Whether or not to add special tokens when encodin... | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1.84 | 2 | 0 | 0 | 9 | 0 | 0 | 0 | 0 | 56 | 2 | 19 | 1 | 18 | 35 | 19 | 1 | 18 | 0 | 1 | 0 | 0 |
6,466 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/processing_utils.py | transformers.processing_utils.VideosKwargs | from .video_utils import VideoInput, VideoMetadata
from .image_utils import ChannelDimension, ImageInput, is_vision_available
from typing import Any, Optional, TypedDict, TypeVar, Union
class VideosKwargs(TypedDict, total=False):
"""
Keyword arguments for video processing.
Attributes:
do_convert_r... |
class VideosKwargs(TypedDict, total=False):
'''
Keyword arguments for video processing.
Attributes:
do_convert_rgb (`bool`):
Whether to convert the video to RGB format.
do_resize (`bool`):
Whether to resize the video.
size (`dict[str, int]`, *optional*):
... | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2.14 | 2 | 0 | 0 | 4 | 0 | 0 | 0 | 0 | 46 | 2 | 14 | 1 | 13 | 30 | 14 | 1 | 13 | 0 | 1 | 0 | 0 |
6,467 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/pytorch_utils.py | transformers.pytorch_utils.Conv1D | import torch
from torch import nn
class Conv1D(nn.Module):
"""
1D-convolutional layer as defined by Radford et al. for OpenAI GPT (and also used in GPT-2).
Basically works like a linear layer but the weights are transposed.
Args:
nf (`int`): The number of output features.
nx (`int`): ... |
class Conv1D(nn.Module):
'''
1D-convolutional layer as defined by Radford et al. for OpenAI GPT (and also used in GPT-2).
Basically works like a linear layer but the weights are transposed.
Args:
nf (`int`): The number of output features.
nx (`int`): The number of input features.
''... | 4 | 1 | 5 | 0 | 5 | 0 | 1 | 0.47 | 1 | 2 | 0 | 0 | 3 | 4 | 3 | 13 | 27 | 5 | 15 | 9 | 11 | 7 | 15 | 9 | 11 | 1 | 1 | 0 | 3 |
6,468 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/quantizers/auto.py | transformers.quantizers.auto.AutoHfQuantizer | import warnings
from ..utils.quantization_config import AqlmConfig, AutoRoundConfig, AwqConfig, BitNetQuantConfig, BitsAndBytesConfig, CompressedTensorsConfig, EetqConfig, FbgemmFp8Config, FineGrainedFP8Config, FPQuantConfig, GPTQConfig, HiggsConfig, HqqConfig, Mxfp4Config, QuantizationConfigMixin, QuantizationMethod, ... |
class AutoHfQuantizer:
'''
The Auto-HF quantizer class that takes care of automatically instantiating to the correct
`HfQuantizer` given the `QuantizationConfig`.
'''
@classmethod
def from_config(cls, quantization_config: Union[QuantizationConfigMixin, dict], **kwargs):
pass
@class... | 9 | 2 | 20 | 3 | 15 | 2 | 4 | 0.17 | 0 | 10 | 7 | 0 | 0 | 0 | 4 | 4 | 91 | 14 | 66 | 21 | 53 | 11 | 40 | 13 | 35 | 6 | 0 | 2 | 17 |
6,469 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/quantizers/auto.py | transformers.quantizers.auto.AutoQuantizationConfig | from ..models.auto.configuration_auto import AutoConfig
from ..utils.quantization_config import AqlmConfig, AutoRoundConfig, AwqConfig, BitNetQuantConfig, BitsAndBytesConfig, CompressedTensorsConfig, EetqConfig, FbgemmFp8Config, FineGrainedFP8Config, FPQuantConfig, GPTQConfig, HiggsConfig, HqqConfig, Mxfp4Config, Quant... |
class AutoQuantizationConfig:
'''
The Auto-HF quantization config class that takes care of automatically dispatching to the correct
quantization config given a quantization config stored in a dictionary.
'''
@classmethod
def from_dict(cls, quantization_config_dict: dict):
pass
@clas... | 5 | 1 | 15 | 1 | 13 | 1 | 4 | 0.21 | 0 | 4 | 2 | 0 | 0 | 0 | 2 | 2 | 39 | 4 | 29 | 11 | 24 | 6 | 19 | 9 | 16 | 5 | 0 | 1 | 7 |
6,470 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/quantizers/base.py | transformers.quantizers.base.HfQuantizer | from typing import TYPE_CHECKING, Any, Optional, Union
from abc import ABC, abstractmethod
from ..utils.quantization_config import QuantizationConfigMixin, QuantizationMethod
from .quantizers_utils import get_module_from_name
class HfQuantizer(ABC):
"""
Abstract class of the HuggingFace quantizer. Supports for... |
class HfQuantizer(ABC):
'''
Abstract class of the HuggingFace quantizer. Supports for now quantizing HF transformers models for inference and/or quantization.
This class is used only for transformers.PreTrainedModel.from_pretrained and cannot be easily used outside the scope of that method
yet.
Att... | 41 | 25 | 8 | 1 | 3 | 4 | 1 | 1.38 | 1 | 8 | 1 | 14 | 20 | 3 | 20 | 40 | 218 | 35 | 77 | 40 | 47 | 106 | 56 | 27 | 35 | 2 | 4 | 1 | 22 |
6,471 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/quantizers/quantizer_aqlm.py | transformers.quantizers.quantizer_aqlm.AqlmHfQuantizer | from ..utils.quantization_config import QuantizationConfigMixin
import importlib
from .base import HfQuantizer
from packaging import version
from ..integrations import replace_with_aqlm_linear
from ..utils import is_accelerate_available, is_aqlm_available, is_torch_available, logging
class AqlmHfQuantizer(HfQuantizer)... |
class AqlmHfQuantizer(HfQuantizer):
'''
Quantizer of the AQLM method. Enables the loading of prequantized models.
'''
def __init__(self, quantization_config: QuantizationConfigMixin, **kwargs):
pass
def validate_environment(self, *args, **kwargs):
pass
def update_dtype(self, ... | 9 | 1 | 7 | 0 | 6 | 0 | 2 | 0.06 | 1 | 3 | 1 | 0 | 7 | 1 | 7 | 47 | 62 | 9 | 50 | 18 | 37 | 3 | 33 | 13 | 25 | 3 | 5 | 2 | 12 |
6,472 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/quantizers/quantizer_awq.py | transformers.quantizers.quantizer_awq.AwqQuantizer | from typing import TYPE_CHECKING, Optional
import importlib.metadata
from .base import HfQuantizer
from ..utils import is_accelerate_available, is_auto_awq_available, is_torch_available, logging
from packaging import version
from ..utils.quantization_config import AWQLinearVersion
class AwqQuantizer(HfQuantizer):
... |
class AwqQuantizer(HfQuantizer):
'''
4-bit quantization for Activation-aware Weight Quantization(AWQ) (https://huggingface.co/papers/2306.00978)
'''
def __init__(self, quantization_config, **kwargs):
pass
def validate_environment(self, device_map, **kwargs):
pass
def update_d... | 9 | 1 | 14 | 2 | 12 | 0 | 4 | 0.08 | 1 | 6 | 1 | 0 | 7 | 2 | 7 | 47 | 118 | 25 | 87 | 19 | 74 | 7 | 62 | 17 | 50 | 12 | 5 | 3 | 27 |
6,473 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/quantizers/quantizer_bitnet.py | transformers.quantizers.quantizer_bitnet.BitNetHfQuantizer | from ..utils import is_accelerate_available, is_torch_available, logging
from .base import HfQuantizer
from typing import TYPE_CHECKING, Optional, Union
class BitNetHfQuantizer(HfQuantizer):
"""
1.58-bit quantization from BitNet quantization method:
Before loading: it converts the linear layers into BitLin... |
class BitNetHfQuantizer(HfQuantizer):
'''
1.58-bit quantization from BitNet quantization method:
Before loading: it converts the linear layers into BitLinear layers during loading.
Check out the paper introducing this method: https://huggingface.co/papers/2402.17764
'''
def __init__(self, quan... | 12 | 2 | 8 | 1 | 7 | 0 | 2 | 0.08 | 1 | 7 | 0 | 0 | 8 | 2 | 8 | 48 | 84 | 17 | 62 | 23 | 45 | 5 | 38 | 16 | 28 | 7 | 5 | 2 | 15 |
6,474 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/quantizers/quantizer_bnb_4bit.py | transformers.quantizers.quantizer_bnb_4bit.Bnb4BitHfQuantizer | import importlib
from .quantizers_utils import get_module_from_name
from ..utils import ACCELERATE_MIN_VERSION, is_accelerate_available, is_bitsandbytes_available, is_torch_available, is_torch_hpu_available, is_torch_npu_available, is_torch_xpu_available, logging
from functools import cached_property
from packaging imp... |
class Bnb4BitHfQuantizer(HfQuantizer):
'''
4-bit quantization from bitsandbytes.py quantization method:
before loading: converts transformer layers into Linear4bit during loading: load 16bit weight and pass to the
layer object after: quantizes individual weights in Linear4bit into 4bit at the f... | 17 | 3 | 20 | 2 | 16 | 2 | 4 | 0.16 | 1 | 12 | 1 | 0 | 14 | 1 | 14 | 54 | 317 | 50 | 232 | 64 | 187 | 36 | 133 | 41 | 111 | 15 | 5 | 4 | 50 |
6,475 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/quantizers/quantizer_bnb_8bit.py | transformers.quantizers.quantizer_bnb_8bit.Bnb8BitHfQuantizer | from typing import TYPE_CHECKING, Any, Optional, Union
import importlib
from ..utils import ACCELERATE_MIN_VERSION, is_accelerate_available, is_bitsandbytes_available, is_torch_available, is_torch_xpu_available, logging
from .base import HfQuantizer
from packaging import version
from .quantizers_utils import get_module... |
class Bnb8BitHfQuantizer(HfQuantizer):
'''
8-bit quantization from bitsandbytes quantization method:
before loading: converts transformer layers into Linear8bitLt during loading: load 16bit weight and pass to the
layer object after: quantizes individual weights in Linear8bitLt into 8bit at fits... | 15 | 2 | 18 | 2 | 15 | 1 | 3 | 0.11 | 1 | 11 | 1 | 0 | 13 | 1 | 13 | 53 | 267 | 43 | 202 | 62 | 160 | 23 | 120 | 40 | 100 | 10 | 5 | 3 | 44 |
6,476 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/quantizers/quantizer_compressed_tensors.py | transformers.quantizers.quantizer_compressed_tensors.CompressedTensorsHfQuantizer | from ..utils import is_compressed_tensors_available, is_torch_available, logging
from .base import HfQuantizer
from ..utils.quantization_config import CompressedTensorsConfig
class CompressedTensorsHfQuantizer(HfQuantizer):
"""
Quantizer for the compressed_tensors package. Loads and restores models to
qua... |
class CompressedTensorsHfQuantizer(HfQuantizer):
'''
Quantizer for the compressed_tensors package. Loads and restores models to
quantized state with compressed_tensors
'''
def __init__(self, quantization_config: CompressedTensorsConfig, **kwargs):
pass
def validate_environment(self, ... | 11 | 4 | 8 | 1 | 7 | 1 | 2 | 0.13 | 1 | 4 | 1 | 0 | 10 | 3 | 10 | 50 | 103 | 23 | 71 | 29 | 51 | 9 | 52 | 26 | 35 | 4 | 5 | 2 | 20 |
6,477 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/quantizers/quantizer_eetq.py | transformers.quantizers.quantizer_eetq.EetqHfQuantizer | from typing import TYPE_CHECKING, Any, Optional
from .base import HfQuantizer
from .quantizers_utils import get_module_from_name
from ..utils import is_accelerate_available, is_eetq_available, is_torch_available, logging
class EetqHfQuantizer(HfQuantizer):
"""
8-bit quantization from EETQ quantization method:
... |
class EetqHfQuantizer(HfQuantizer):
'''
8-bit quantization from EETQ quantization method:
before loading: converts transformer layers into W8A16Linear during loading: load 16bit weight and pass to the
layer object after: quantizes individual weights in Linear8bitLt into 8bit at first .cuda() ca... | 11 | 2 | 14 | 1 | 12 | 1 | 3 | 0.1 | 1 | 8 | 0 | 0 | 9 | 2 | 9 | 49 | 151 | 24 | 116 | 46 | 80 | 12 | 64 | 23 | 50 | 10 | 5 | 3 | 25 |
6,478 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/quantizers/quantizer_fbgemm_fp8.py | transformers.quantizers.quantizer_fbgemm_fp8.FbgemmFp8HfQuantizer | from .quantizers_utils import get_module_from_name
from typing import TYPE_CHECKING, Any, Optional
from .base import HfQuantizer
from ..utils import is_accelerate_available, is_fbgemm_gpu_available, is_torch_available, logging
class FbgemmFp8HfQuantizer(HfQuantizer):
"""
FP8 quantization using fbgemm kernels
... |
class FbgemmFp8HfQuantizer(HfQuantizer):
'''
FP8 quantization using fbgemm kernels
'''
def __init__(self, quantization_config, **kwargs):
pass
def validate_environment(self, *args, **kwargs):
pass
def update_dtype(self, dtype: 'torch.dtype') -> 'torch.dtype':
pass
... | 13 | 2 | 15 | 1 | 13 | 1 | 3 | 0.06 | 1 | 9 | 1 | 0 | 10 | 2 | 10 | 50 | 169 | 25 | 137 | 50 | 101 | 8 | 73 | 28 | 59 | 9 | 5 | 4 | 30 |
6,479 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/quantizers/quantizer_gptq.py | transformers.quantizers.quantizer_gptq.GptqHfQuantizer | from .base import HfQuantizer
from ..utils import is_auto_gptq_available, is_gptqmodel_available, is_optimum_available, is_torch_available, logging
from packaging import version
from ..utils.quantization_config import GPTQConfig, QuantizationConfigMixin
import importlib
class GptqHfQuantizer(HfQuantizer):
"""
... |
class GptqHfQuantizer(HfQuantizer):
'''
Quantizer of the GPTQ method - for GPTQ the quantizer support calibration of the model through
`auto_gptq` or `gptqmodel` package. Quantization is done under the hood for users if they load a non-prequantized model.
'''
def __init__(self, quantization_config... | 10 | 1 | 9 | 1 | 8 | 0 | 3 | 0.09 | 1 | 5 | 2 | 0 | 8 | 0 | 8 | 48 | 90 | 14 | 70 | 15 | 59 | 6 | 51 | 14 | 41 | 7 | 5 | 2 | 24 |
6,480 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/quantizers/quantizer_higgs.py | transformers.quantizers.quantizer_higgs.HiggsHfQuantizer | from typing import TYPE_CHECKING, Any, Optional
from ..utils import is_accelerate_available, is_flute_available, is_hadamard_available, is_torch_available, logging
from ..utils.quantization_config import QuantizationConfigMixin
from .quantizers_utils import get_module_from_name
from .base import HfQuantizer
from ..util... |
class HiggsHfQuantizer(HfQuantizer):
'''
Quantizer of the HIGGS method. Enables the loading of prequantized models and in-flight quantization of full-precision models.
'''
def __init__(self, quantization_config: QuantizationConfigMixin, **kwargs):
pass
def validate_environment(self, devic... | 14 | 1 | 15 | 2 | 13 | 1 | 3 | 0.08 | 1 | 10 | 2 | 0 | 11 | 1 | 11 | 51 | 186 | 29 | 146 | 54 | 107 | 11 | 79 | 34 | 60 | 7 | 5 | 4 | 32 |
6,481 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/quantizers/quantizer_hqq.py | transformers.quantizers.quantizer_hqq.HqqHfQuantizer | from .base import HfQuantizer
from ..integrations import prepare_for_hqq_linear
from ..utils import is_accelerate_available, is_hqq_available, is_torch_available, logging
from typing import TYPE_CHECKING, Any
from .quantizers_utils import get_module_from_name
class HqqHfQuantizer(HfQuantizer):
"""
HQQ quantize... |
class HqqHfQuantizer(HfQuantizer):
'''
HQQ quantizer base HF class.
nn.Linear modules are first tagged with quant_config in _process_model_before_weight_loading().
The actual quantization and offloading to the GPU is done in check_quantized_param().
'''
def __init__(self, quantization_config, ... | 17 | 2 | 18 | 2 | 14 | 1 | 4 | 0.14 | 1 | 11 | 0 | 0 | 11 | 2 | 11 | 51 | 252 | 44 | 182 | 67 | 139 | 26 | 124 | 41 | 107 | 13 | 5 | 3 | 47 |
6,482 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/quantizers/quantizer_quanto.py | transformers.quantizers.quantizer_quanto.QuantoHfQuantizer | from .base import HfQuantizer
from ..utils import is_accelerate_available, is_optimum_quanto_available, is_torch_available, logging
from packaging import version
from typing import TYPE_CHECKING, Any, Optional, Union
import importlib
from ..utils.quantization_config import QuantoConfig
from .quantizers_utils import get... |
class QuantoHfQuantizer(HfQuantizer):
'''
Quantizer for the quanto library
'''
def __init__(self, quantization_config: QuantoConfig, **kwargs):
pass
def post_init(self):
'''
Safety checker
'''
pass
def validate_environment(self, *args, **kwargs):
... | 16 | 4 | 10 | 1 | 9 | 1 | 2 | 0.13 | 1 | 11 | 1 | 0 | 14 | 1 | 14 | 54 | 168 | 24 | 128 | 52 | 90 | 16 | 81 | 34 | 61 | 6 | 5 | 4 | 32 |
6,483 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/quantizers/quantizer_torchao.py | transformers.quantizers.quantizer_torchao.TorchAoHfQuantizer | from .quantizers_utils import get_module_from_name
from .base import HfQuantizer
from ..utils.quantization_config import TorchAoConfig
import importlib
from packaging import version
from ..utils import is_torch_available, is_torchao_available, logging
from typing import TYPE_CHECKING, Optional, Union
from typing import... |
class TorchAoHfQuantizer(HfQuantizer):
'''
Quantizer for torchao: https://github.com/pytorch/ao/
'''
def __init__(self, quantization_config, **kwargs):
pass
def validate_environment(self, *args, **kwargs):
pass
def update_dtype(self, dtype):
pass
def adjust_targe... | 16 | 4 | 13 | 1 | 12 | 1 | 3 | 0.1 | 1 | 10 | 0 | 0 | 11 | 2 | 11 | 51 | 165 | 19 | 133 | 45 | 102 | 13 | 81 | 29 | 66 | 8 | 5 | 3 | 32 |
6,484 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/quantizers/quantizer_vptq.py | transformers.quantizers.quantizer_vptq.VptqHfQuantizer | from ..utils import is_accelerate_available, is_torch_available, is_vptq_available, logging
from typing import TYPE_CHECKING, Optional
from .base import HfQuantizer
from ..utils.quantization_config import QuantizationConfigMixin
class VptqHfQuantizer(HfQuantizer):
"""
Quantizer of the VPTQ method. Enables the ... |
class VptqHfQuantizer(HfQuantizer):
'''
Quantizer of the VPTQ method. Enables the loading of prequantized models.
'''
def __init__(self, quantization_config: QuantizationConfigMixin, **kwargs):
pass
def validate_environment(self, *args, **kwargs):
pass
def update_dtype(self, ... | 9 | 2 | 7 | 1 | 6 | 1 | 2 | 0.15 | 1 | 4 | 1 | 0 | 7 | 1 | 7 | 47 | 67 | 12 | 48 | 20 | 33 | 7 | 34 | 15 | 24 | 4 | 5 | 3 | 12 |
6,485 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/sagemaker/trainer_sm.py | transformers.sagemaker.trainer_sm.SageMakerTrainer | from ..trainer import Trainer
import warnings
class SageMakerTrainer(Trainer):
def __init__(self, args=None, **kwargs):
warnings.warn('`SageMakerTrainer` is deprecated and will be removed in v5 of Transformers. You can use `Trainer` instead.', FutureWarning)
super().__init__(args=args, **kwargs) |
class SageMakerTrainer(Trainer):
def __init__(self, args=None, **kwargs):
pass | 2 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 86 | 8 | 0 | 8 | 2 | 6 | 0 | 4 | 2 | 2 | 1 | 1 | 0 | 1 |
6,486 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/sagemaker/training_args_sm.py | transformers.sagemaker.training_args_sm.SageMakerTrainingArguments | from ..utils import is_sagemaker_dp_enabled, logging
from ..training_args import TrainingArguments
import warnings
import os
import torch
from functools import cached_property
from dataclasses import dataclass, field
@dataclass
class SageMakerTrainingArguments(TrainingArguments):
mp_parameters: str = field(default... | @dataclass
class SageMakerTrainingArguments(TrainingArguments):
def __post_init__(self):
pass
@cached_property
def _setup_devices(self) -> 'torch.device':
pass
@property
def world_size(self):
pass
@property
def place_model_on_device(self):
pass
@property
... | 11 | 0 | 12 | 1 | 9 | 2 | 3 | 0.2 | 1 | 3 | 0 | 0 | 5 | 2 | 5 | 37 | 74 | 9 | 55 | 16 | 44 | 11 | 37 | 12 | 30 | 9 | 1 | 2 | 14 |
6,487 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/time_series_utils.py | transformers.time_series_utils.AffineTransformed | from torch.distributions import AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution
class AffineTransformed(TransformedDistribution):
def __init__(self, base_distribution: Distribution, loc=None, scale=None, event_dim=0):
self.scale = 1.0 if scale is Non... |
class AffineTransformed(TransformedDistribution):
def __init__(self, base_distribution: Distribution, loc=None, scale=None, event_dim=0):
pass
@property
def mean(self):
'''
Returns the mean of the distribution.
'''
pass
@property
def variance(self):
... | 8 | 3 | 5 | 0 | 3 | 2 | 2 | 0.64 | 1 | 2 | 0 | 0 | 4 | 2 | 4 | 38 | 27 | 4 | 14 | 10 | 6 | 9 | 11 | 7 | 6 | 3 | 2 | 0 | 6 |
6,488 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/time_series_utils.py | transformers.time_series_utils.DistributionOutput | from torch import nn
import torch
from torch.distributions import AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution
from typing import Callable, Optional
class DistributionOutput:
distribution_class: type
in_features: int
args_dim: dict[str, int]
d... |
class DistributionOutput:
def __init__(self, dim: int=1) -> None:
pass
def _base_distribution(self, distr_args):
pass
def distribution(self, distr_args, loc: Optional[torch.Tensor]=None, scale: Optional[torch.Tensor]=None) -> Distribution:
pass
@property
def event_shape(s... | 14 | 6 | 6 | 0 | 4 | 3 | 1 | 0.53 | 0 | 9 | 3 | 3 | 8 | 1 | 9 | 9 | 75 | 9 | 43 | 21 | 24 | 23 | 28 | 12 | 18 | 2 | 0 | 1 | 12 |
6,489 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/time_series_utils.py | transformers.time_series_utils.LambdaLayer | from torch import nn
class LambdaLayer(nn.Module):
def __init__(self, function):
super().__init__()
self.function = function
def forward(self, x, *args):
return self.function(x, *args) |
class LambdaLayer(nn.Module):
def __init__(self, function):
pass
def forward(self, x, *args):
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 7 | 1 | 6 | 4 | 3 | 0 | 6 | 4 | 3 | 1 | 1 | 0 | 2 |
6,490 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/time_series_utils.py | transformers.time_series_utils.NegativeBinomialOutput | import torch
from torch.distributions import AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution
from typing import Callable, Optional
class NegativeBinomialOutput(DistributionOutput):
"""
Negative Binomial distribution output class.
"""
args_dim: dic... |
class NegativeBinomialOutput(DistributionOutput):
'''
Negative Binomial distribution output class.
'''
@classmethod
def domain_map(cls, total_count: torch.Tensor, logits: torch.Tensor):
pass
def _base_distribution(self, distr_args) -> Distribution:
pass
def distributio... | 5 | 1 | 6 | 1 | 5 | 0 | 2 | 0.35 | 1 | 3 | 0 | 0 | 2 | 0 | 3 | 12 | 33 | 6 | 20 | 11 | 13 | 7 | 16 | 8 | 12 | 2 | 1 | 1 | 5 |
6,491 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/time_series_utils.py | transformers.time_series_utils.NormalOutput | import torch
from torch.distributions import AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution
class NormalOutput(DistributionOutput):
"""
Normal distribution output class.
"""
args_dim: dict[str, int] = {'loc': 1, 'scale': 1}
distribution_class... |
class NormalOutput(DistributionOutput):
'''
Normal distribution output class.
'''
@classmethod
def domain_map(cls, loc: torch.Tensor, scale: torch.Tensor):
pass | 3 | 1 | 3 | 0 | 3 | 0 | 1 | 0.43 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 10 | 12 | 2 | 7 | 5 | 4 | 3 | 6 | 4 | 4 | 1 | 1 | 0 | 1 |
6,492 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/time_series_utils.py | transformers.time_series_utils.ParameterProjection | from typing import Callable, Optional
from torch import nn
import torch
class ParameterProjection(nn.Module):
def __init__(self, in_features: int, args_dim: dict[str, int], domain_map: Callable[..., tuple[torch.Tensor]], **kwargs) -> None:
super().__init__(**kwargs)
self.args_dim = args_dim
... |
class ParameterProjection(nn.Module):
def __init__(self, in_features: int, args_dim: dict[str, int], domain_map: Callable[..., tuple[torch.Tensor]], **kwargs) -> None:
pass
def forward(self, x: torch.Tensor) -> tuple[torch.Tensor]:
pass | 3 | 0 | 6 | 1 | 5 | 0 | 1 | 0 | 1 | 4 | 0 | 0 | 2 | 3 | 2 | 12 | 13 | 2 | 11 | 9 | 6 | 0 | 9 | 7 | 6 | 1 | 1 | 0 | 2 |
6,493 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/time_series_utils.py | transformers.time_series_utils.StudentTOutput | from torch.distributions import AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution
import torch
class StudentTOutput(DistributionOutput):
"""
Student-T distribution output class.
"""
args_dim: dict[str, int] = {'df': 1, 'loc': 1, 'scale': 1}
dist... |
class StudentTOutput(DistributionOutput):
'''
Student-T distribution output class.
'''
@classmethod
def domain_map(cls, df: torch.Tensor, loc: torch.Tensor, scale: torch.Tensor):
pass | 3 | 1 | 4 | 0 | 4 | 0 | 1 | 0.38 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 10 | 13 | 2 | 8 | 5 | 5 | 3 | 7 | 4 | 5 | 1 | 1 | 0 | 1 |
6,494 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/tokenization_utils.py | transformers.tokenization_utils.ExtensionsTrie | class ExtensionsTrie(Trie):
def __init__(self, *args):
super().__init__(*args)
def extensions(self, prefix: str):
"""
Generates all extensions of a given prefix token in the Trie.
Example:
```python
>>> trie = Trie()
>>> trie.add("apple")
>>> t... | class ExtensionsTrie(Trie):
def __init__(self, *args):
pass
def extensions(self, prefix: str):
'''
Generates all extensions of a given prefix token in the Trie.
Example:
```python
>>> trie = Trie()
>>> trie.add("apple")
>>> trie.add("app")
... | 5 | 3 | 13 | 2 | 5 | 7 | 2 | 1.24 | 1 | 4 | 0 | 0 | 4 | 1 | 4 | 9 | 57 | 10 | 21 | 12 | 16 | 26 | 21 | 12 | 16 | 4 | 1 | 2 | 9 |
6,495 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/tokenization_utils.py | transformers.tokenization_utils.PreTrainedTokenizer | import re
import itertools
from typing import Any, Optional, Union, overload
from .utils import PaddingStrategy, TensorType, add_end_docstrings, logging
from .tokenization_utils_base import ENCODE_KWARGS_DOCSTRING, ENCODE_PLUS_ADDITIONAL_KWARGS_DOCSTRING, INIT_TOKENIZER_DOCSTRING, AddedToken, BatchEncoding, EncodedInpu... | @add_end_docstrings(INIT_TOKENIZER_DOCSTRING)
class PreTrainedTokenizer(PreTrainedTokenizerBase):
'''
Base class for all slow tokenizers.
Inherits from [`~tokenization_utils_base.PreTrainedTokenizerBase`].
Handle all the shared methods for tokenization and special tokens as well as methods downloading/c... | 40 | 16 | 24 | 2 | 17 | 6 | 4 | 0.39 | 1 | 18 | 3 | 100 | 28 | 5 | 28 | 89 | 727 | 92 | 464 | 169 | 347 | 179 | 247 | 81 | 216 | 16 | 2 | 4 | 108 |
6,496 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/tokenization_utils.py | transformers.tokenization_utils.Trie | from collections import OrderedDict
class Trie:
"""
Trie in Python. Creates a Trie out of a list of words. The trie is used to split on `added_tokens` in one pass
Loose reference https://en.wikipedia.org/wiki/Trie
"""
def __init__(self, *args):
self.data = {}
self._tokens = set()
... |
class Trie:
'''
Trie in Python. Creates a Trie out of a list of words. The trie is used to split on `added_tokens` in one pass
Loose reference https://en.wikipedia.org/wiki/Trie
'''
def __init__(self, *args):
pass
def update(self, *args):
'''
Updates the Trie with new ... | 6 | 4 | 44 | 5 | 18 | 21 | 6 | 1.16 | 0 | 5 | 0 | 1 | 5 | 3 | 5 | 5 | 229 | 30 | 92 | 26 | 86 | 107 | 83 | 26 | 77 | 19 | 0 | 6 | 29 |
6,497 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/tokenization_utils_base.py | transformers.tokenization_utils_base.BatchEncoding | from collections import UserDict
import numpy as np
import warnings
from .utils import CHAT_TEMPLATE_DIR, CHAT_TEMPLATE_FILE, ExplicitEnum, PaddingStrategy, PushToHubMixin, TensorType, add_end_docstrings, cached_file, copy_func, download_url, extract_commit_hash, is_mlx_available, is_numpy_array, is_offline_mode, is_pr... |
class BatchEncoding(UserDict):
'''
Holds the output of the [`~tokenization_utils_base.PreTrainedTokenizerBase.__call__`],
[`~tokenization_utils_base.PreTrainedTokenizerBase.encode_plus`] and
[`~tokenization_utils_base.PreTrainedTokenizerBase.batch_encode_plus`] methods (tokens, attention_masks, etc).
... | 29 | 18 | 22 | 3 | 9 | 9 | 3 | 1.1 | 1 | 18 | 2 | 0 | 24 | 3 | 24 | 79 | 634 | 115 | 248 | 67 | 197 | 272 | 183 | 48 | 150 | 16 | 8 | 3 | 81 |
6,498 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/tokenization_utils_base.py | transformers.tokenization_utils_base.CharSpan | from typing import TYPE_CHECKING, Any, Callable, NamedTuple, Optional, Union
class CharSpan(NamedTuple):
"""
Character span in the original string.
Args:
start (`int`): Index of the first character in the original string.
end (`int`): Index of the character following the last character in ... |
class CharSpan(NamedTuple):
'''
Character span in the original string.
Args:
start (`int`): Index of the first character in the original string.
end (`int`): Index of the character following the last character in the original string.
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 2 | 3 | 1 | 2 | 6 | 3 | 1 | 2 | 0 | 1 | 0 | 0 |
6,499 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/tokenization_utils_base.py | transformers.tokenization_utils_base.PreTrainedTokenizerBase | import copy
from .utils.chat_template_utils import render_jinja_template
from pathlib import Path
import numpy as np
import warnings
from .utils import CHAT_TEMPLATE_DIR, CHAT_TEMPLATE_FILE, ExplicitEnum, PaddingStrategy, PushToHubMixin, TensorType, add_end_docstrings, cached_file, copy_func, download_url, extract_comm... | @add_end_docstrings(INIT_TOKENIZER_DOCSTRING)
class PreTrainedTokenizerBase(SpecialTokensMixin, PushToHubMixin):
'''
Base class for [`PreTrainedTokenizer`] and [`PreTrainedTokenizerFast`].
Handles shared (mostly boiler plate) methods for those two classes.
'''
def __init__(self, **kwargs):
... | 69 | 36 | 56 | 5 | 36 | 15 | 7 | 0.41 | 2 | 26 | 3 | 2 | 41 | 12 | 47 | 61 | 2,744 | 302 | 1,740 | 552 | 1,362 | 714 | 810 | 217 | 758 | 50 | 1 | 7 | 329 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.