transformers/docs/source/en/index.md
Orr Zohar 4397dfcb71
SmolVLM2 (#36126)
* smolvlm init

* updates

* fixing bugs

* minimal run, no checks

* minimal run, no checks

* passing first check + adding url support

* updating video dataloading logic

* fixing image logic

* trying modular, but fails

* modular is working, changing processor to match PR comments and general transformers logic

* fixing kwargs

* offloading video loading logic to  image_util

* fixing circleci code formatting errors

* fixing circleci code formatting errors

* fixing circleci code formatting errors

* fixing circleci code formatting errors

* fixing circleci code formatting errors

* fixing circleci code formatting errors

* fixing circleci code formatting errors

* fixing circleci code formatting errors

* fixing circleci code formatting errors

* fixing circleci code formatting errors

* fixing circleci code formatting errors

* fixing circleci code formatting errors

* fixing circleci code formatting errors

* fixing circleci code formatting errors

* update

* add idefics3-based tests

* add keyword to all

* add PreTrainedModel

* updateing video loading logic

* working inference

* updates for PR comments

* updates for PR comments

* moving SmolVLMPretrainedModel higher to fix import error

* CI test pass

* CI test pass

* removing lambda

* CI test pass

* CI test pass

* CI test pass

* CI test pass

* CI test pass

* CI test pass

* processor tests

* add example in docs

* typo

* fix copies

* skip compile tests - sdpa for VisionTransformer

* fix init

* raise import error for num2words

* update doc for FA2

* more doc fix

* CI

* updates for PR comments

* Update docs/source/en/model_doc/smolvlm.md

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>

* Update docs/source/en/model_doc/smolvlm.md

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>

* Update docs/source/en/model_doc/smolvlm.md

Co-authored-by: Joshua Lochner <admin@xenova.com>

* Update docs/source/en/model_doc/smolvlm.md

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>

* Update docs/source/en/model_doc/smolvlm.md

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>

* fixing processor -- tokenizer not defined properly, (gpt2 tokenizer), and does not have the attributes of fake image token, etc

* adding smolvlm to VQA models

* removing vqa auto class

* Update src/transformers/models/smolvlm/processing_smolvlm.py

Co-authored-by: Joshua Lochner <admin@xenova.com>

* removing smolvlmvisiontransformer from index.md

* my bad, video processing had typos

* fixing docs

* renaming params in SmolVLMModel.inputs_merger

* removing un-needed dtype/device in model forward

* ruff for CI

* update docs

* Update docs/source/en/model_doc/smolvlm.md

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>

* return cache position

* return cache position

* return cache also in modular

* needed to run modular again

* fix training tests

* push vectorized inputs merger

* format

* format

* reduce number of mappings

* addressing PR comments

* happy CI, happy me :)

* skip non-nested images

* adjust integration test for smaller GPUs

* format

* fix kwargs in chat template apply

* skip this for now

---------

Co-authored-by: raushan <raushan@huggingface.co>
Co-authored-by: Pablo <pablo.montalvo.leroux@gmail.com>
Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
Co-authored-by: Joshua Lochner <admin@xenova.com>
2025-02-20 15:00:26 +01:00

48 KiB

🤗 Transformers

State-of-the-art Machine Learning for PyTorch, TensorFlow, and JAX.

🤗 Transformers provides APIs and tools to easily download and train state-of-the-art pretrained models. Using pretrained models can reduce your compute costs, carbon footprint, and save you the time and resources required to train a model from scratch. These models support common tasks in different modalities, such as:

📝 Natural Language Processing: text classification, named entity recognition, question answering, language modeling, code generation, summarization, translation, multiple choice, and text generation.
🖼️ Computer Vision: image classification, object detection, and segmentation.
🗣️ Audio: automatic speech recognition and audio classification.
🐙 Multimodal: table question answering, optical character recognition, information extraction from scanned documents, video classification, and visual question answering.

🤗 Transformers support framework interoperability between PyTorch, TensorFlow, and JAX. This provides the flexibility to use a different framework at each stage of a model's life; train a model in three lines of code in one framework, and load it for inference in another. Models can also be exported to a format like ONNX and TorchScript for deployment in production environments.

Join the growing community on the Hub, forum, or Discord today!

If you are looking for custom support from the Hugging Face team

HuggingFace Expert Acceleration Program

Contents

The documentation is organized into five sections:

  • GET STARTED provides a quick tour of the library and installation instructions to get up and running.

  • TUTORIALS are a great place to start if you're a beginner. This section will help you gain the basic skills you need to start using the library.

  • HOW-TO GUIDES show you how to achieve a specific goal, like finetuning a pretrained model for language modeling or how to write and share a custom model.

  • CONCEPTUAL GUIDES offers more discussion and explanation of the underlying concepts and ideas behind models, tasks, and the design philosophy of 🤗 Transformers.

  • API describes all classes and functions:

    • MAIN CLASSES details the most important classes like configuration, model, tokenizer, and pipeline.
    • MODELS details the classes and functions related to each model implemented in the library.
    • INTERNAL HELPERS details utility classes and functions used internally.

Supported models and frameworks

The table below represents the current support in the library for each of those models, whether they have a Python tokenizer (called "slow"). A "fast" tokenizer backed by the 🤗 Tokenizers library, whether they have support in Jax (via Flax), PyTorch, and/or TensorFlow.

Model PyTorch support TensorFlow support Flax Support
ALBERT
ALIGN
AltCLIP
Aria
AriaText
Audio Spectrogram Transformer
Autoformer
Bamba
Bark
BART
BARThez
BARTpho
BEiT
BERT
Bert Generation
BertJapanese
BERTweet
BigBird
BigBird-Pegasus
BioGpt
BiT
Blenderbot
BlenderbotSmall
BLIP
BLIP-2
BLOOM
BORT
BridgeTower
BROS
ByT5
CamemBERT
CANINE
Chameleon
Chinese-CLIP
CLAP
CLIP
CLIPSeg
CLVP
CodeGen
CodeLlama
Cohere
Cohere2
ColPali
Conditional DETR
ConvBERT
ConvNeXT
ConvNeXTV2
CPM
CPM-Ant
CTRL
CvT
DAB-DETR
DAC
Data2VecAudio
Data2VecText
Data2VecVision
DBRX
DeBERTa
DeBERTa-v2
Decision Transformer
Deformable DETR
DeiT
DePlot
Depth Anything
DepthPro
DETA
DETR
DialoGPT
DiffLlama
DiNAT
DINOv2
DINOv2 with Registers
DistilBERT
DiT
DonutSwin
DPR
DPT
EfficientFormer
EfficientNet
ELECTRA
Emu3
EnCodec
Encoder decoder
ERNIE
ErnieM
ESM
FairSeq Machine-Translation
Falcon
Falcon3
FalconMamba
FastSpeech2Conformer
FLAN-T5
FLAN-UL2
FlauBERT
FLAVA
FNet
FocalNet
Funnel Transformer
Fuyu
Gemma
Gemma2
GIT
GLM
GLPN
GOT-OCR2
GPT Neo
GPT NeoX
GPT NeoX Japanese
GPT-J
GPT-Sw3
GPTBigCode
GPTSAN-japanese
Granite
GraniteMoeMoe
GraniteMoeSharedMoe
Graphormer
Grounding DINO
GroupViT
Helium
HerBERT
Hiera
Hubert
I-BERT
I-JEPA
IDEFICS
Idefics2
Idefics3
Idefics3VisionTransformer
ImageGPT
Informer
InstructBLIP
InstructBlipVideo
Jamba
JetMoe
Jukebox
KOSMOS-2
LayoutLM
LayoutLMv2
LayoutLMv3
LayoutXLM
LED
LeViT
LiLT
LLaMA
Llama2
Llama3
LLaVa
LLaVA-NeXT
LLaVa-NeXT-Video
LLaVA-Onevision
Longformer
LongT5
LUKE
LXMERT
M-CTC-T
M2M100
MADLAD-400
Mamba
mamba2
Marian
MarkupLM
Mask2Former
MaskFormer
MatCha
mBART
mBART-50
MEGA
Megatron-BERT
Megatron-GPT2
MGP-STR
Mimi
Mistral
Mixtral
Mllama
mLUKE
MMS
MobileBERT
MobileNetV1
MobileNetV2
MobileViT
MobileViTV2
ModernBERT
Moonshine
Moshi
MPNet
MPT
MRA
MT5
MusicGen
MusicGen Melody
MVP
NAT
Nemotron
Nezha
NLLB
NLLB-MOE
Nougat
Nyströmformer
OLMo
OLMo2
OLMoE
OmDet-Turbo
OneFormer
OpenAI GPT
OpenAI GPT-2
OpenLlama
OPT
OWL-ViT
OWLv2
PaliGemma
PatchTSMixer
PatchTST
Pegasus
PEGASUS-X
Perceiver
Persimmon
Phi
Phi3
Phimoe
PhoBERT
Pix2Struct
Pixtral
PLBart
PoolFormer
Pop2Piano
ProphetNet
PVT
PVTv2
QDQBert
Qwen2
Qwen2_5_VL
Qwen2Audio
Qwen2MoE
Qwen2VL
RAG
REALM
RecurrentGemma
Reformer
RegNet
RemBERT
ResNet
RetriBERT
RoBERTa
RoBERTa-PreLayerNorm
RoCBert
RoFormer
RT-DETR
RT-DETR-ResNet
RT-DETRv2
RWKV
SAM
SeamlessM4T
SeamlessM4Tv2
SegFormer
SegGPT
SEW
SEW-D
SigLIP
SmolVLM
Speech Encoder decoder
Speech2Text
SpeechT5
Splinter
SqueezeBERT
StableLm
Starcoder2
SuperGlue
SuperPoint
SwiftFormer
Swin Transformer
Swin Transformer V2
Swin2SR
SwitchTransformers
T5
T5v1.1
Table Transformer
TAPAS
TAPEX
TextNet
Time Series Transformer
TimeSformer
TimmWrapperModel
Trajectory Transformer
Transformer-XL
TrOCR
TVLT
TVP
UDOP
UL2
UMT5
UniSpeech
UniSpeechSat
UnivNet
UPerNet
VAN
VideoLlava
VideoMAE
ViLT
VipLlava
Vision Encoder decoder
VisionTextDualEncoder
VisualBERT
ViT
ViT Hybrid
VitDet
ViTMAE
ViTMatte
ViTMSN
ViTPose
ViTPoseBackbone
VITS
ViViT
Wav2Vec2
Wav2Vec2-BERT
Wav2Vec2-Conformer
Wav2Vec2Phoneme
WavLM
Whisper
X-CLIP
X-MOD
XGLM
XLM
XLM-ProphetNet
XLM-RoBERTa
XLM-RoBERTa-XL
XLM-V
XLNet
XLS-R
XLSR-Wav2Vec2
YOLOS
YOSO
Zamba
Zamba2
ZoeDepth