huggingface/transformers
🤗 Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.
https://skillcdn.ai/gh/huggingface/transformersConnect this address to your AI to use these skills. How to connect
- Unverified
- Default branch
main - Commit
6259c23 - License
Apache-2.0 - Searchwords
Explore this repository
Searches the original text of skills and documents, and the translations of skills when you search in their language.
Folders
Documents
- _config.pydocs/source/en/_config.py
- _redirects.ymldocs/source/en/_redirects.yml
- _toctree.ymldocs/source/en/_toctree.yml
- AccelerateAccelerate provides a unified interface for distributed training backends like FSDP or DeepSpeed. It detects your environment (number of GPUs, distributed backend, mixed precision, etc.) and automati…docs/source/en/accelerate.md
- Add audio processing componentsAudio models require a feature extractor which is accessible behind the [AutoFeatureExtractor] entry point.docs/source/en/add_audio_processing_components.md
- Legacy model contributionMany of the models in Transformers are contributed by developers and researchers. As an open-source first project, we're invested in empowering the community to actively and independently add more mo…docs/source/en/add_new_model.md
- Adding a new pipelineMake [Pipeline] your own by subclassing it and implementing a few methods. Share the code with the community on the Hub and register the pipeline with Transformers so that everyone can quickly and ea…docs/source/en/add_new_pipeline.md
- Add vision processing componentsAdding a vision model requires image or video processing components on top of the standard modular approach. Image-only models need image processors and video models need a video processor, both of w…docs/source/en/add_vision_processing_components.md
- AMD GPUAMD Instinct (MI200, MI300, MI350 series) and Radeon GPUs run PyTorch through ROCm, AMD's GPU software stack. The ROCm build of PyTorch uses HIP, AMD’s CUDA-like programming interface, to expose AMD…docs/source/en/amd_gpu.md
- Apple SiliconApple Silicon (M-series) chips run PyTorch through the Metal Performance Shaders (MPS) backend, with the device string mps. The CPU and GPU share one pool of unified memory.docs/source/en/apple_silicon.md
- Assisted decodingAssisted decoding speeds up text generation by allowing a helper propose candidate tokens before the main model commits to them. The main model verifies the candidate tokens in one forward pass. The…docs/source/en/assisted_decoding.md
- Attention backendsAll attention implementations perform the same computation. Every token is compared to every other token. The difference is how the computation is performed. Basic attention scales poorly because it…docs/source/en/attention_interface.md
- Auto-generating docstringsThe @auto_docstring decorator generates consistent docstrings for model classes and methods. It pulls in standard argument descriptions automatically, so you only write documentation for new or custo…docs/source/en/auto_docstring.md
- AWS TrainiumAWS Trainium instances run PyTorch natively through the torch-neuronx package, which registers the neuron device. Neuron compiles your model into one or more graphs for each input shape it sees, so k…docs/source/en/aws_trainium.md
- BackbonesHigher-level computer visions tasks, such as object detection or image segmentation, use several models together to generate a prediction. A separate model is used for the backbone, neck, and head. T…docs/source/en/backbones.md
- How caching worksImagine you're having a conversation with someone, and instead of remembering what they previously said, they have to start from scratch every time you respond. This would be slow and inefficient, ri…docs/source/en/cache_explanation.md
- Chat message patternsChat models expect conversations as a list of dictionaries. Each dictionary uses role and content keys. The content key holds the user message passed to the model. Large language models accept text a…docs/source/en/chat_content_patterns.md
- Tool useChat models are commonly trained with support for "function-calling" or "tool-use". Tools are functions supplied by the user, which the model can choose to call as part of its response. For example,…docs/source/en/chat_extras.md
- Response ParsingIt is increasingly common for chat models to generate structured outputs, rather than just a single reply string. For example, a reasoning model might emit a chain of thought containing its reasoning…docs/source/en/chat_response_parsing.md
- Chat templatesThe chat basics guide covers how to store chat histories and generate text from chat models using [TextGenerationPipeline].docs/source/en/chat_templating.md
- Multimodal chat templatesMultimodal chat models accept inputs like images, audio or video, in addition to text. The content key in a multimodal chat history is a list containing multiple items of different types. This is unl…docs/source/en/chat_templating_multimodal.md
- Writing a chat templateA chat template is a Jinja template stored in the tokenizer's [~PreTrainedTokenizer.chat_template] attribute. Jinja is a templating language that allows you to write Python-like code and syntax.docs/source/en/chat_templating_writing.md
- CommunityThis page regroups resources around 🤗 Transformers developed by the community.docs/source/en/community.md
- Continuous batchingContinuous batching maximizes GPU utilization by dynamically rescheduling the batch at every generation step. As requests finish, new ones join immediately instead of waiting for the whole batch to c…docs/source/en/continuous_batching.md
- Continuous batching architectureTraditional batching processes a fixed group of requests together and waits for the slowest one to finish before starting the next group. This causes the GPU to idle between batches.docs/source/en/continuous_batching_architecture.md
- Chat basicsChat models are conversational models you can send a message to and receive a response. Most language models from mid-2023 onwards are chat models and may be referred to as "instruct" or "instruction…docs/source/en/conversations.md
- CPUCPUs run Transformers models with the device string cpu, without an accelerator. They work for inference and training when GPUs aren't available, or when you want a cost-effective setup.docs/source/en/cpu.md
- Customizing modelsTransformers models are designed to be customizable. A models code is fully contained in the model subfolder of the Transformers repository. Each folder contains a modeling.py and a configuration.py…docs/source/en/custom_models.md
- Customizing tokenizersTokenizers are decoupled from their learned vocabularies. This allows you to initialize an empty tokenizer for training or create one directly with your own vocabulary. The underlying tokenization pi…docs/source/en/custom_tokenizers.md
- Data collatorsA data collator assembles individual dataset samples into a batch for the model. It can also dynamically pad samples to the longest sequence in each batch, which is more efficient than padding to a g…docs/source/en/data_collators.md
- DDPDistributedDataParallel (DDP) maintains a full copy of a model on each GPU. Each GPU processes a non-overlapping shard of data with a forward and backward pass. Before the optimizer step, an all-redu…docs/source/en/ddp.md
- DebuggingDebugging distributed training problems typically falls into one of these categories: numerical issues, communication failures, runtime errors, and build errors.docs/source/en/debugging.md
- DeepSpeed ZeRODeepSpeed ZeRO (Zero Redundancy Optimizer) eliminates memory redundancy across distributed training by sharding optimizer states, gradients, and parameters across GPUs. ZeRO has three stages, each sh…docs/source/en/deepspeed.md
- Ulysses sequence parallelismUlysses sequence parallelism (SP) trains on very long sequences by splitting them across multiple GPUs. To compute attention correctly, an all-to-all collective swaps the sharding dimension from sequ…docs/source/en/deepspeed_alst.md
- Expert parallelismExpert parallelism is a parallelism strategy for mixture-of-experts (MoE) models. Each expert's feedforward layer lives on a different hardware accelerator. A router dispatches tokens to the appropri…docs/source/en/expert_parallelism.md
- Experts backendsAll Mixture-of-Experts (MoE) implementations perform the same high-level computation. For each token, a router selects k experts. The token hidden state is then projected through the selected experts…docs/source/en/experts_interface.md
- ExportersExport any [PreTrainedModel] to ONNX, ExecuTorch, or a standalone PyTorch program, regardless of the target runtime.docs/source/en/exporters.md
- Extending the exporterstorch.export traces the model into a graph, later stages transform that graph, and a final stage lowers or emits it for the target runtime. Most models pass through untouched. When there's a PyTorch…docs/source/en/exporters_extend.md
- Quantizing exportsEvery export config can take a quantizer, which quantizes the model during the export. The quantizers live in transformers.exporters.quantizers, and each one runs at a fixed point of the export: on t…docs/source/en/exporters_quantization.md
- TokenizersA tokenizer converts text into tensors, which are the inputs to a model. It normalizes and splits text, applies the tokenization algorithm, adds special tokens, and decodes output ids back into text.docs/source/en/fast_tokenizers.md
- Feature extractorsFeature extractors preprocess audio data into the correct format for a given model. It takes the raw audio signal and converts it into a tensor that can be fed to a model. The tensor shape depends on…docs/source/en/feature_extractors.md
Skipped (50)
These manifests were not served. Fix them and push: the next commit is indexed again.
README.mdlink_missinga link names no file of the repository (./contributing)docs/source/en/accelerate.mdlink_missing3 links name no file of the repository (./fsdp, ./deepspeed, ./ddp)docs/source/en/add_audio_processing_components.mdlink_missing3 links name no file of the repository (./modular_transformers, ./auto_docstring, ./feature_extractors)docs/source/en/add_new_model.mdlink_missing7 links name no file of the repository (./modular_transformers, ./philosophy, ./installation#editable-install, ...)docs/source/en/add_vision_processing_components.mdlink_missing4 links name no file of the repository (./modular_transformers, ./auto_docstring, ./image_processors, ...)docs/source/en/amd_gpu.mdlink_missing12 links name no file of the repository (./attention_interface, ./kernel_doc/loading_kernels, ./quantization/awq, ...)docs/source/en/apple_silicon.mdlink_missing10 links name no file of the repository (./attention_interface, ./model_doc/gpt_oss, ./quantization/gguf#attention, ...)docs/source/en/assisted_decoding.mdlink_missing2 links name no file of the repository (./perf_torch_compile, ./kv_cache#fixed-size-cache)docs/source/en/attention_interface.mdlink_missinga link names no file of the repository (./kernel_doc/loading_kernels#flashattention-fallback)docs/source/en/auto_docstring.mdlink_missinga link names no file of the repository (./modular_transformers)docs/source/en/aws_trainium.mdlink_missing4 links name no file of the repository (./kv_cache#keep-generation-tensors-on-cpu, ./tensor_parallelism, ./expert_parallelism, ...)docs/source/en/backbones.mdlink_missing4 links name no file of the repository (./main_classes/backbones, ./model_doc/auto, ./model_doc/resnet, ...)docs/source/en/chat_content_patterns.mdlink_missinga link names no file of the repository (./chat_extras)docs/source/en/chat_extras.mdlink_missing3 links name no file of the repository (./model_doc/cohere, ./model_doc/mixtral, ./chat_response_parsing)docs/source/en/chat_response_parsing.mdlink_missing2 links name no file of the repository (./chat_extras, ./chat_templating)docs/source/en/chat_templating.mdlink_missing3 links name no file of the repository (./conversations, ./model_doc/llama, ./tasks/language_modeling)docs/source/en/chat_templating_multimodal.mdlink_missing6 links name no file of the repository (./fast_tokenizers, ./processors, ./llm_tutorial#prompt-format, ...)docs/source/en/chat_templating_writing.mdlink_missing2 links name no file of the repository (./chat_extras, ./model_doc/cohere)docs/source/en/community.mdlink_missinga link names no file of the repository (glossary)docs/source/en/community_integrations/axolotl.mdlink_missing3 links name no file of the repository (./trl, ../main_classes/quantization, ../attention_interface)docs/source/en/community_integrations/candle.mdlink_missinga link names no file of the repository (../installation#cache-directory)docs/source/en/community_integrations/executorch.mdlink_missinga link names no file of the repository (../serialization#executorch)docs/source/en/community_integrations/nemo_automodel_finetuning.mdlink_missinga link names no file of the repository (./nemo_automodel_pretraining)docs/source/en/community_integrations/nemo_automodel_pretraining.mdlink_missinga link names no file of the repository (./nemo_automodel_finetuning)docs/source/en/community_integrations/sglang.mdlink_missinga link names no file of the repository (./transformers_as_backend#model-implementation)docs/source/en/community_integrations/torchtitan.mdlink_missinga link names no file of the repository (../perf_torch_compile)docs/source/en/community_integrations/transformers_as_backend.mdlink_missing3 links name no file of the repository (../add_new_model, ../custom_models, ../add_vision_processing_components)docs/source/en/continuous_batching.mdlink_missing8 links name no file of the repository (./serve-cli/serving_optims#continuous-batching, ./continuous_batching_architecture#memory-management, ./continuous_batching_architecture#chunked-prefill, ...)docs/source/en/continuous_batching_architecture.mdlink_missinga link names no file of the repository (./continuous_batching)docs/source/en/conversations.mdlink_missing12 links name no file of the repository (./installation, ./serve-cli/serving, ./model_doc/auto, ...)docs/source/en/cpu.mdlink_missinga link names no file of the repository (./ddp)docs/source/en/custom_models.mdlink_missing3 links name no file of the repository (./models#model-classes, ./model_doc/auto, ./models#custom-models)docs/source/en/custom_tokenizers.mdlink_missinga link names no file of the repository (./fast_tokenizers#backends)docs/source/en/data_collators.mdlink_missinga link names no file of the repository (./main_classes/data_collator)docs/source/en/ddp.mdlink_missing3 links name no file of the repository (./accelerate, ./fsdp, ./deepspeed)docs/source/en/deepspeed.mdlink_missing2 links name no file of the repository (./debugging#deepspeed-cuda, ./accelerate#accelerate-config-file)docs/source/en/deepspeed_alst.mdlink_missing3 links name no file of the repository (./accelerate#accelerate-config-file, ./fsdp#evaluate-with-context-parallelism, ./perf_train_gpu_many)docs/source/en/expert_parallelism.mdlink_missing2 links name no file of the repository (./perf_infer_gpu_multi, ./fsdp)docs/source/en/experts_interface.mdlink_missinga link names no file of the repository (./quantization/finegrained_fp8)docs/source/en/exporters.mdlink_missing2 links name no file of the repository (./exporters_quantization, ./exporters_extend)docs/source/en/exporters_quantization.mdlink_missing2 links name no file of the repository (./exporters, ./exporters#how-exportforgeneration-works)docs/source/en/fast_tokenizers.mdlink_missinga link names no file of the repository (./custom_tokenizers)docs/source/en/feature_extractors.mdlink_missing2 links name no file of the repository (./model_doc/auto, ./model_doc/whisper)docs/source/en/fsdp.mdlink_missing8 links name no file of the repository (./ddp, ./tensor_parallelism, ./expert_parallelism, ...)docs/source/en/fusion_mapping.mdlink_missing2 links name no file of the repository (./monkey_patching, ./weightconverter)docs/source/en/glossary.mdlink_missing9 links name no file of the repository (./model_doc/dpt, ./perf_train_gpu_many#dataparallel, ./training, ...)docs/source/en/google_tpu.mdlink_missing2 links name no file of the repository (./kv_cache#keep-generation-tensors-on-cpu, ./kernel_doc/loading_kernels)docs/source/en/grad_accumulation.mdlink_missing4 links name no file of the repository (./trainer_recipes#custom-loss-function, ./model_memory_anatomy, ./grad_checkpointing, ...)docs/source/en/grad_checkpointing.mdlink_missing4 links name no file of the repository (./grad_accumulation, ./model_memory_anatomy, ./mixed_precision_training, ...)docs/source/en/hardware.mdlink_missing8 links name no file of the repository (./cpu, ./nvidia_gpu, ./amd_gpu, ...)