file_name
stringlengths
5
73
relative_path
stringlengths
7
117
extension
stringclasses
6 values
size_bytes
int64
0
971k
content
stringlengths
0
960k
auto.py
src/transformers/quantizers/auto.py
.py
13,788
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # Modifications Copyright (C) 2025, Advanced Micro Devices, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the Lic...
quantizer_eetq.py
src/transformers/quantizers/quantizer_eetq.py
.py
3,841
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
quantizer_spqr.py
src/transformers/quantizers/quantizer_spqr.py
.py
2,688
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lic enses/LICENSE-2.0 # # Unless required by app...
quantizer_gptq.py
src/transformers/quantizers/quantizer_gptq.py
.py
4,334
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
quantizer_bitnet.py
src/transformers/quantizers/quantizer_bitnet.py
.py
3,846
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
quantizer_auto_round.py
src/transformers/quantizers/quantizer_auto_round.py
.py
2,686
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
quantizer_bnb_8bit.py
src/transformers/quantizers/quantizer_bnb_8bit.py
.py
6,751
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
quantizer_aqlm.py
src/transformers/quantizers/quantizer_aqlm.py
.py
2,567
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
quantizer_fp_quant.py
src/transformers/quantizers/quantizer_fp_quant.py
.py
6,197
# Copyright 2025 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
quantizer_awq.py
src/transformers/quantizers/quantizer_awq.py
.py
3,680
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
quantizer_finegrained_fp8.py
src/transformers/quantizers/quantizer_finegrained_fp8.py
.py
6,829
from typing import TYPE_CHECKING from ..utils import is_accelerate_available, is_torch_available, is_torch_xpu_available, logging from .base import HfQuantizer from .quantizers_utils import get_module_from_name if is_torch_available(): import torch if TYPE_CHECKING: from ..modeling_utils import PreTrainedMo...
quantizer_torchao.py
src/transformers/quantizers/quantizer_torchao.py
.py
11,498
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
quantizer_mxfp4.py
src/transformers/quantizers/quantizer_mxfp4.py
.py
11,772
# Copyright 2025 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
quantizer_higgs.py
src/transformers/quantizers/quantizer_higgs.py
.py
7,390
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
quantizer_compressed_tensors.py
src/transformers/quantizers/quantizer_compressed_tensors.py
.py
4,781
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
quantizer_fbgemm_fp8.py
src/transformers/quantizers/quantizer_fbgemm_fp8.py
.py
8,489
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
base.py
src/transformers/quantizers/base.py
.py
12,727
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
quantizer_vptq.py
src/transformers/quantizers/quantizer_vptq.py
.py
2,416
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
pt_utils.py
src/transformers/pipelines/pt_utils.py
.py
12,816
import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class PipelineDataset(Dataset): def __init__(self, dataset, process, params): self.dataset = dataset self.process = process self.params = params def __len__(s...
video_classification.py
src/transformers/pipelines/video_classification.py
.py
7,628
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
zero_shot_image_classification.py
src/transformers/pipelines/zero_shot_image_classification.py
.py
7,644
from collections import UserDict from typing import Any, Union, overload from ..utils import ( add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import Pipeline, build_pipeline_init_args if is_vision_available(): from PIL import Image f...
zero_shot_audio_classification.py
src/transformers/pipelines/zero_shot_audio_classification.py
.py
6,687
# Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
audio_classification.py
src/transformers/pipelines/audio_classification.py
.py
11,074
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
__init__.py
src/transformers/pipelines/__init__.py
.py
69,115
# Copyright 2018 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
automatic_speech_recognition.py
src/transformers/pipelines/automatic_speech_recognition.py
.py
33,511
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
zero_shot_object_detection.py
src/transformers/pipelines/zero_shot_object_detection.py
.py
10,393
from typing import Any, Union, overload from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import ChunkPipeline, build_pipeline_init_args if is_vision_available(): from PIL import Image from ..image_utils import load_image, valid_images if...
keypoint_matching.py
src/transformers/pipelines/keypoint_matching.py
.py
7,056
# Copyright 2025 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
feature_extraction.py
src/transformers/pipelines/feature_extraction.py
.py
3,406
from typing import Any from ..utils import add_end_docstrings from .base import GenericTensor, Pipeline, build_pipeline_init_args @add_end_docstrings( build_pipeline_init_args(has_tokenizer=True, supports_binary_output=False), r""" tokenize_kwargs (`dict`, *optional*): Additional dict...
fill_mask.py
src/transformers/pipelines/fill_mask.py
.py
11,064
from typing import Any, overload import numpy as np from ..utils import add_end_docstrings, is_torch_available, logging from .base import GenericTensor, Pipeline, PipelineException, build_pipeline_init_args if is_torch_available(): import torch logger = logging.get_logger(__name__) @add_end_docstrings( ...
depth_estimation.py
src/transformers/pipelines/depth_estimation.py
.py
6,115
from typing import Any, Union, overload from ..utils import ( add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import Pipeline, build_pipeline_init_args if is_vision_available(): from PIL import Image from ..image_utils import load_ima...
token_classification.py
src/transformers/pipelines/token_classification.py
.py
28,882
import types import warnings from typing import Any, overload import numpy as np from ..models.bert.tokenization_bert_legacy import BasicTokenizer from ..utils import ( ExplicitEnum, add_end_docstrings, is_torch_available, ) from .base import ArgumentHandler, ChunkPipeline, Dataset, build_pipeline_init_ar...
image_segmentation.py
src/transformers/pipelines/image_segmentation.py
.py
9,748
from typing import Any, Union, overload import numpy as np from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import Pipeline, build_pipeline_init_args if is_vision_available(): from PIL import Image from ..image_utils import load_image i...
mask_generation.py
src/transformers/pipelines/mask_generation.py
.py
15,328
from collections import defaultdict from typing import TYPE_CHECKING, Any, Union, overload from ..image_utils import load_image from ..utils import ( add_end_docstrings, is_torch_available, logging, requires_backends, ) from .base import ChunkPipeline, build_pipeline_init_args if is_torch_available()...
image_text_to_text.py
src/transformers/pipelines/image_text_to_text.py
.py
21,352
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
question_answering.py
src/transformers/pipelines/question_answering.py
.py
28,793
import inspect import types from collections.abc import Iterable from typing import TYPE_CHECKING import numpy as np from ..data import SquadExample, SquadFeatures, squad_convert_examples_to_features from ..tokenization_python import PreTrainedTokenizer from ..utils import ( PaddingStrategy, add_end_docstring...
object_detection.py
src/transformers/pipelines/object_detection.py
.py
8,346
from typing import TYPE_CHECKING, Any, Union, overload from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import Pipeline, build_pipeline_init_args if is_vision_available(): from ..image_utils import load_image if is_torch_available(): imp...
image_feature_extraction.py
src/transformers/pipelines/image_feature_extraction.py
.py
4,794
from typing import Any, Union from ..utils import add_end_docstrings, is_vision_available from .base import GenericTensor, Pipeline, build_pipeline_init_args if is_vision_available(): from PIL import Image from ..image_utils import load_image @add_end_docstrings( build_pipeline_init_args(has_image_pro...
any_to_any.py
src/transformers/pipelines/any_to_any.py
.py
24,680
# Copyright 2025 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
zero_shot_classification.py
src/transformers/pipelines/zero_shot_classification.py
.py
11,976
import inspect import numpy as np from ..tokenization_python import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import ArgumentHandler, ChunkPipeline, build_pipeline_init_args logger = logging.get_logger(__name__) class ZeroShotClassificationArgumentHandler(ArgumentHandler): ...
table_question_answering.py
src/transformers/pipelines/table_question_answering.py
.py
17,171
import collections import types import numpy as np from ..generation import GenerationConfig from ..utils import ( add_end_docstrings, is_torch_available, requires_backends, ) from .base import ArgumentHandler, Dataset, Pipeline, PipelineException, build_pipeline_init_args if is_torch_available(): i...
text_to_audio.py
src/transformers/pipelines/text_to_audio.py
.py
13,103
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
visual_question_answering.py
src/transformers/pipelines/visual_question_answering.py
.py
9,599
from typing import Union from ..generation import GenerationConfig from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import Pipeline, build_pipeline_init_args if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_a...
text_classification.py
src/transformers/pipelines/text_classification.py
.py
10,166
import inspect from typing import Any import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_torch_available from .base import GenericTensor, Pipeline, build_pipeline_init_args if is_torch_available(): from ..models.auto.modeling_auto import MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES ...
image_to_image.py
src/transformers/pipelines/image_to_image.py
.py
5,261
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
image_classification.py
src/transformers/pipelines/image_classification.py
.py
9,880
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
audio_utils.py
src/transformers/pipelines/audio_utils.py
.py
12,191
# Copyright 2023 The HuggingFace Team. All rights reserved. import datetime import platform import subprocess import numpy as np def ffmpeg_read(bpayload: bytes, sampling_rate: int) -> np.ndarray: """ Helper function to read an audio file through ffmpeg. """ ar = f"{sampling_rate}" ac = "1" f...
document_question_answering.py
src/transformers/pipelines/document_question_answering.py
.py
25,269
# Copyright 2022 The Impira Team and the HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
text_generation.py
src/transformers/pipelines/text_generation.py
.py
24,920
import enum from typing import Any, overload from ..generation import GenerationConfig from ..utils import ModelOutput, add_end_docstrings, is_torch_available from ..utils.chat_template_utils import Chat, ChatType from .base import Pipeline, build_pipeline_init_args if is_torch_available(): import torch fro...
base.py
src/transformers/pipelines/base.py
.py
59,155
# Copyright 2018 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...