text stringlengths 31 243k | type stringclasses 1
value | start int64 36 275k | end int64 286 280k | depth int64 0 1 | filepath stringlengths 85 188 | parent_class stringclasses 3
values | class_index int64 0 10.8k |
|---|---|---|---|---|---|---|---|
class ReturnException(Exception):
def __init__(self, value):
self.value = value | class_definition | 1,662 | 1,753 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/agents/python_interpreter.py | null | 400 |
class AgentType:
"""
Abstract class to be reimplemented to define types that can be returned by agents.
These objects serve three purposes:
- They behave as they were the type they're meant to be, e.g., a string for text, a PIL.Image for images
- They can be stringified: str(object) in order to re... | class_definition | 1,086 | 2,052 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/agents/agent_types.py | null | 401 |
class AgentText(AgentType, str):
"""
Text type returned by the agent. Behaves as a string.
"""
def to_raw(self):
return self._value
def to_string(self):
return str(self._value) | class_definition | 2,055 | 2,269 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/agents/agent_types.py | null | 402 |
class AgentImage(AgentType, ImageType):
"""
Image type returned by the agent. Behaves as a PIL.Image.
"""
def __init__(self, value):
AgentType.__init__(self, value)
ImageType.__init__(self)
if not is_vision_available():
raise ImportError("PIL must be installed in or... | class_definition | 2,272 | 5,257 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/agents/agent_types.py | null | 403 |
class AgentAudio(AgentType, str):
"""
Audio type returned by the agent.
"""
def __init__(self, value, samplerate=16_000):
super().__init__(value)
if not is_soundfile_available():
raise ImportError("soundfile must be installed in order to handle audio.")
self._path ... | class_definition | 5,260 | 7,368 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/agents/agent_types.py | null | 404 |
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):
item = self.dataset[i]
processed = self.pro... | class_definition | 129 | 499 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/pt_utils.py | null | 405 |
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... | class_definition | 502 | 6,571 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/pt_utils.py | null | 406 |
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)
```
Argument... | class_definition | 6,574 | 8,366 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/pt_utils.py | null | 407 |
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 d... | class_definition | 8,369 | 12,138 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/pt_utils.py | null | 408 |
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_definition | 12,141 | 12,402 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/pt_utils.py | null | 409 |
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):
return {"text": self.dataset[i][self.key1], "tex... | class_definition | 12,405 | 12,761 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/pt_utils.py | null | 410 |
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.
Example:
```python
>>> from transformers import ... | class_definition | 964 | 8,803 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/text_to_audio.py | null | 411 |
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... | class_definition | 5,341 | 9,165 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/question_answering.py | null | 412 |
class QuestionAnsweringPipeline(ChunkPipeline):
"""
Question Answering pipeline using any `ModelForQuestionAnswering`. See the [question answering
examples](../task_summary#question-answering) for more information.
Example:
```python
>>> from transformers import pipeline
>>> oracle = pipe... | class_definition | 9,234 | 30,354 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/question_answering.py | null | 413 |
class ReturnType(enum.Enum):
TENSORS = 0
TEXT = 1 | class_definition | 523 | 580 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/text2text_generation.py | null | 414 |
class Text2TextGenerationPipeline(Pipeline):
"""
Pipeline for text to text generation using seq2seq models.
Example:
```python
>>> from transformers import pipeline
>>> generator = pipeline(model="mrm8488/t5-base-finetuned-question-generation-ap")
>>> generator(
... "answer: Manue... | class_definition | 649 | 9,695 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/text2text_generation.py | null | 415 |
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 models that this pipeline can use are models that have been fin... | class_definition | 9,764 | 13,284 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/text2text_generation.py | null | 416 |
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"`.
The models that this pipeline can use are models that have been fi... | class_definition | 13,353 | 17,705 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/text2text_generation.py | null | 417 |
class ImageSegmentationPipeline(Pipeline):
"""
Image segmentation pipeline using any `AutoModelForXXXSegmentation`. This pipeline predicts masks of objects and
their classes.
Example:
```python
>>> from transformers import pipeline
>>> segmenter = pipeline(model="facebook/detr-resnet-50-p... | class_definition | 791 | 9,613 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/image_segmentation.py | null | 418 |
class VisualQuestionAnsweringPipeline(Pipeline):
"""
Visual Question Answering pipeline using a `AutoModelForVisualQuestionAnswering`. This pipeline is currently only
available in PyTorch.
Example:
```python
>>> from transformers import pipeline
>>> oracle = pipeline(model="dandelin/vilt-... | class_definition | 560 | 9,191 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/visual_question_answering.py | null | 419 |
class ClassificationFunction(ExplicitEnum):
SIGMOID = "sigmoid"
SOFTMAX = "softmax"
NONE = "none" | class_definition | 1,735 | 1,844 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/image_classification.py | null | 420 |
class ImageClassificationPipeline(Pipeline):
"""
Image classification pipeline using any `AutoModelForImageClassification`. This pipeline predicts the class of an
image.
Example:
```python
>>> from transformers import pipeline
>>> classifier = pipeline(model="microsoft/beit-base-patch16-2... | class_definition | 2,541 | 9,780 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/image_classification.py | null | 421 |
class FillMaskPipeline(Pipeline):
"""
Masked language modeling prediction pipeline using any `ModelWithLMHead`. See the [masked language modeling
examples](../task_summary#masked-language-modeling) for more information.
Example:
```python
>>> from transformers import pipeline
>>> fill_mas... | class_definition | 1,075 | 11,640 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/fill_mask.py | null | 422 |
class ImageToTextPipeline(Pipeline):
"""
Image To Text pipeline using a `AutoModelForVision2Seq`. This pipeline predicts a caption for a given image.
Example:
```python
>>> from transformers import pipeline
>>> captioner = pipeline(model="ydshieh/vit-gpt2-coco-en")
>>> captioner("https://... | class_definition | 1,330 | 9,504 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/image_to_text.py | null | 423 |
class ImageFeatureExtractionPipeline(Pipeline):
"""
Image feature extraction pipeline uses no model head. This pipeline extracts the hidden states from the base
transformer, which can be used as features in downstream tasks.
Example:
```python
>>> from transformers import pipeline
>>> ext... | class_definition | 698 | 4,731 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/image_feature_extraction.py | null | 424 |
class AudioClassificationPipeline(Pipeline):
"""
Audio classification pipeline using any `AutoModelForAudioClassification`. This pipeline predicts the class of a
raw waveform or an audio file. In case of an audio file, ffmpeg should be installed to support multiple audio
formats.
Example:
```p... | class_definition | 2,017 | 10,122 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/audio_classification.py | null | 425 |
class VideoClassificationPipeline(Pipeline):
"""
Video classification pipeline using any `AutoModelForVideoClassification`. This pipeline predicts the class of a
video.
This video classification pipeline can currently be loaded from [`pipeline`] using the following task identifier:
`"video-classifi... | class_definition | 1,166 | 7,445 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/video_classification.py | null | 426 |
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
>>> import requests
>>> from transformers import pipeline
>>> ups... | class_definition | 1,162 | 5,021 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/image_to_image.py | null | 427 |
class FeatureExtractionPipeline(Pipeline):
"""
Feature extraction pipeline uses no model head. This pipeline extracts the hidden states from the base
transformer, which can be used as features in downstream tasks.
Example:
```python
>>> from transformers import pipeline
>>> extractor = pi... | class_definition | 535 | 3,373 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/feature_extraction.py | null | 428 |
class DepthEstimationPipeline(Pipeline):
"""
Depth estimation pipeline using any `AutoModelForDepthEstimation`. This pipeline predicts the depth of an image.
Example:
```python
>>> from transformers import pipeline
>>> depth_estimator = pipeline(task="depth-estimation", model="LiheYoung/depth... | class_definition | 538 | 5,747 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/depth_estimation.py | null | 429 |
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_labels`.
<Tip warning={true}>
The default `hypothesis_template` is : `"This is a sound ... | class_definition | 996 | 6,868 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/zero_shot_audio_classification.py | null | 430 |
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):
if isinstance(labels, str):
labels = [label.strip() ... | class_definition | 284 | 1,585 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/zero_shot_classification.py | null | 431 |
class ZeroShotClassificationPipeline(ChunkPipeline):
"""
NLI-based zero-shot classification pipeline using a `ModelForSequenceClassification` trained on NLI (natural
language inference) tasks. Equivalent of `text-classification` pipelines, but these models don't require a
hardcoded number of potential c... | class_definition | 1,654 | 12,499 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/zero_shot_classification.py | null | 432 |
class ReturnType(enum.Enum):
TENSORS = 0
NEW_TEXT = 1
FULL_TEXT = 2 | class_definition | 1,257 | 1,336 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/image_text_to_text.py | null | 433 |
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_definition | 1,339 | 2,099 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/image_text_to_text.py | null | 434 |
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 or more chats,
in which case the pipeline will operate in cha... | class_definition | 4,411 | 20,483 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/image_text_to_text.py | null | 435 |
class ClassificationFunction(ExplicitEnum):
SIGMOID = "sigmoid"
SOFTMAX = "softmax"
NONE = "none" | class_definition | 730 | 839 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/text_classification.py | null | 436 |
class TextClassificationPipeline(Pipeline):
"""
Text classification pipeline using any `ModelForSequenceClassification`. See the [sequence classification
examples](../task_summary#sequence-classification) for more information.
Example:
```python
>>> from transformers import pipeline
>>> c... | class_definition | 1,777 | 11,043 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/text_classification.py | null | 437 |
class ModelType(ExplicitEnum):
LayoutLM = "layoutlm"
LayoutLMv2andv3 = "layoutlmv2andv3"
VisionEncoderDecoder = "vision_encoder_decoder" | class_definition | 3,472 | 3,620 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/document_question_answering.py | null | 438 |
class DocumentQuestionAnsweringPipeline(ChunkPipeline):
# TODO: Update task_summary docs to include an example with document QA and then update the first sentence
"""
Document Question Answering pipeline using any `AutoModelForDocumentQuestionAnswering`. The inputs/outputs are
similar to the (extractive... | class_definition | 3,715 | 24,285 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/document_question_answering.py | null | 439 |
class ReturnType(enum.Enum):
TENSORS = 0
NEW_TEXT = 1
FULL_TEXT = 2 | class_definition | 476 | 555 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/text_generation.py | null | 440 |
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_definition | 558 | 1,158 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/text_generation.py | null | 441 |
class TextGenerationPipeline(Pipeline):
"""
Language generation pipeline using any `ModelWithLMHead`. This pipeline predicts the words that will follow a
specified text prompt. When the underlying model is a conversational model, it can also accept one or more chats,
in which case the pipeline will oper... | class_definition | 1,227 | 22,917 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/text_generation.py | null | 442 |
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`.
Example:
```python
>>> from transformers import pipeline
... | class_definition | 634 | 10,250 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/zero_shot_object_detection.py | null | 443 |
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
Example:
`... | class_definition | 4,880 | 33,143 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/automatic_speech_recognition.py | null | 444 |
class MaskGenerationPipeline(ChunkPipeline):
"""
Automatic mask generation for images using `SamForMaskGeneration`. This pipeline predicts binary masks for an
image, given an image. It is a `ChunkPipeline` because you can seperate the points in a mini-batch in order to
avoid OOM issues. Use the `points_... | class_definition | 992 | 13,203 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/mask_generation.py | null | 445 |
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:
```python
>>> from transformers import pipeline
>>> classifi... | class_definition | 810 | 7,817 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/zero_shot_image_classification.py | null | 446 |
class ObjectDetectionPipeline(Pipeline):
"""
Object detection pipeline using any `AutoModelForObjectDetection`. This pipeline predicts bounding boxes of objects
and their classes.
Example:
```python
>>> from transformers import pipeline
>>> detector = pipeline(model="facebook/detr-resnet-... | class_definition | 648 | 8,218 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/object_detection.py | null | 447 |
class TableQuestionAnsweringArgumentHandler(ArgumentHandler):
"""
Handles arguments for the TableQuestionAnsweringPipeline
"""
def __call__(self, table=None, query=None, **kwargs):
# Returns tqa_pipeline_inputs of shape:
# [
# {"table": pd.DataFrame, "query": List[str]},
... | class_definition | 703 | 3,031 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/table_question_answering.py | null | 448 |
class TableQuestionAnsweringPipeline(Pipeline):
"""
Table Question Answering pipeline using a `ModelForTableQuestionAnswering`. This pipeline is only available in
PyTorch.
Example:
```python
>>> from transformers import pipeline
>>> oracle = pipeline(model="google/tapas-base-finetuned-wtq... | class_definition | 3,100 | 20,357 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/table_question_answering.py | null | 449 |
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_definition | 19,887 | 20,306 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/base.py | null | 450 |
class ArgumentHandler(ABC):
"""
Base interface for handling arguments for each [`~pipelines.Pipeline`].
"""
@abstractmethod
def __call__(self, *args, **kwargs):
raise NotImplementedError() | class_definition | 20,309 | 20,526 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/base.py | null | 451 |
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 dat... | class_definition | 20,529 | 24,583 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/base.py | null | 452 |
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... | class_definition | 24,586 | 26,018 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/base.py | null | 453 |
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... | class_definition | 26,021 | 27,235 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/base.py | null | 454 |
class PipedPipelineDataFormat(PipelineDataFormat):
"""
Read data from piped input to the python process. For multi columns data, columns should separated by \t
If columns are provided, then the output will be a dictionary with {column_x: value_x}
Args:
output_path (`str`): Where to save the ou... | class_definition | 27,238 | 28,817 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/base.py | null | 455 |
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_definition | 28,820 | 29,089 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/base.py | null | 456 |
class Pipeline(_ScikitCompat, PushToHubMixin):
"""
The Pipeline class is the class from which all pipelines inherit. Refer to this class for methods shared across
different pipelines.
Base class implementing pipelined operations. Pipeline workflow is defined as a sequence of the following
operation... | class_definition | 33,557 | 58,437 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/base.py | null | 457 |
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_outputs.appe... | class_definition | 58,729 | 60,539 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/base.py | null | 458 |
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]:
supported_task = list(self.supported_tasks.keys()) + lis... | class_definition | 60,542 | 63,052 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/base.py | null | 459 |
class TokenClassificationArgumentHandler(ArgumentHandler):
"""
Handles arguments for token classification.
"""
def __call__(self, inputs: Union[str, List[str]], **kwargs):
if inputs is not None and isinstance(inputs, (list, tuple)) and len(inputs) > 0:
inputs = list(inputs)
... | class_definition | 634 | 1,702 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/token_classification.py | null | 460 |
class AggregationStrategy(ExplicitEnum):
"""All the valid aggregation strategies for TokenClassificationPipeline"""
NONE = "none"
SIMPLE = "simple"
FIRST = "first"
AVERAGE = "average"
MAX = "max" | class_definition | 1,705 | 1,925 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/token_classification.py | null | 461 |
class TokenClassificationPipeline(ChunkPipeline):
"""
Named Entity Recognition pipeline using any `ModelForTokenClassification`. See the [named entity recognition
examples](../task_summary#named-entity-recognition) for more information.
Example:
```python
>>> from transformers import pipeline
... | class_definition | 4,779 | 26,898 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/pipelines/token_classification.py | null | 462 |
class TrialShortNamer:
PREFIX = "hp"
DEFAULTS = {}
NAMING_INFO = None
@classmethod
def set_defaults(cls, prefix, defaults):
cls.PREFIX = prefix
cls.DEFAULTS = defaults
cls.build_naming_info()
@staticmethod
def shortname_for_word(info, word):
if len(word) == ... | class_definition | 631 | 4,978 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/hp_naming.py | null | 463 |
class EmptyTqdm:
"""Dummy tqdm which doesn't do anything."""
def __init__(self, *args, **kwargs): # pylint: disable=unused-argument
self._iterator = args[0] if args else None
def __iter__(self):
return iter(self._iterator)
def __getattr__(self, _):
"""Return empty function.""... | class_definition | 10,700 | 11,251 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/logging.py | null | 464 |
class _tqdm_cls:
def __call__(self, *args, **kwargs):
if _tqdm_active:
return tqdm_lib.tqdm(*args, **kwargs)
else:
return EmptyTqdm(*args, **kwargs)
def set_lock(self, *args, **kwargs):
self._lock = None
if _tqdm_active:
return tqdm_lib.tqdm.s... | class_definition | 11,254 | 11,692 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/logging.py | null | 465 |
class Pop2PianoFeatureExtractor(metaclass=DummyObject):
_backends = ["essentia", "librosa", "pretty_midi", "scipy", "torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["essentia", "librosa", "pretty_midi", "scipy", "torch"]) | class_definition | 129 | 389 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_essentia_and_librosa_and_pretty_midi_and_scipy_and_torch_objects.py | null | 466 |
class Pop2PianoTokenizer(metaclass=DummyObject):
_backends = ["essentia", "librosa", "pretty_midi", "scipy", "torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["essentia", "librosa", "pretty_midi", "scipy", "torch"]) | class_definition | 392 | 645 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_essentia_and_librosa_and_pretty_midi_and_scipy_and_torch_objects.py | null | 467 |
class Pop2PianoProcessor(metaclass=DummyObject):
_backends = ["essentia", "librosa", "pretty_midi", "scipy", "torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["essentia", "librosa", "pretty_midi", "scipy", "torch"]) | class_definition | 648 | 901 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_essentia_and_librosa_and_pretty_midi_and_scipy_and_torch_objects.py | null | 468 |
class LayoutLMv2Model:
def __init__(self, *args, **kwargs):
requires_backends(self, ["detectron2"])
@classmethod
def from_pretrained(cls, *args, **kwargs):
requires_backends(cls, ["detectron2"]) | class_definition | 116 | 339 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_detectron2_objects.py | null | 469 |
class Action(ExplicitEnum):
NONE = "none"
NOTIFY = "notify"
NOTIFY_ALWAYS = "notify_always"
RAISE = "raise" | class_definition | 776 | 899 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/deprecation.py | null | 470 |
class PyTorchBenchmark(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 129 | 286 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 471 |
class PyTorchBenchmarkArguments(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 289 | 455 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 472 |
class Cache(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 458 | 604 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 473 |
class CacheConfig(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 607 | 759 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 474 |
class DynamicCache(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 762 | 915 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 475 |
class EncoderDecoderCache(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 918 | 1,078 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 476 |
class HQQQuantizedCache(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 1,081 | 1,239 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 477 |
class HybridCache(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 1,242 | 1,394 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 478 |
class MambaCache(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 1,397 | 1,548 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 479 |
class OffloadedCache(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 1,551 | 1,706 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 480 |
class OffloadedStaticCache(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 1,709 | 1,870 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 481 |
class QuantizedCache(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 1,873 | 2,028 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 482 |
class QuantizedCacheConfig(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 2,031 | 2,192 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 483 |
class QuantoQuantizedCache(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 2,195 | 2,356 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 484 |
class SinkCache(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 2,359 | 2,509 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 485 |
class SlidingWindowCache(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 2,512 | 2,671 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 486 |
class StaticCache(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 2,674 | 2,826 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 487 |
class GlueDataset(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 2,829 | 2,981 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 488 |
class GlueDataTrainingArguments(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 2,984 | 3,150 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 489 |
class LineByLineTextDataset(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 3,153 | 3,315 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 490 |
class LineByLineWithRefDataset(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 3,318 | 3,483 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 491 |
class LineByLineWithSOPTextDataset(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 3,486 | 3,655 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 492 |
class SquadDataset(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 3,658 | 3,811 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 493 |
class SquadDataTrainingArguments(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 3,814 | 3,981 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 494 |
class TextDataset(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 3,984 | 4,136 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 495 |
class TextDatasetForNextSentencePrediction(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 4,139 | 4,316 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 496 |
class AlternatingCodebooksLogitsProcessor(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 4,319 | 4,495 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 497 |
class BayesianDetectorConfig(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 4,498 | 4,661 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 498 |
class BayesianDetectorModel(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | class_definition | 4,664 | 4,826 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/utils/dummy_pt_objects.py | null | 499 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.