Get state-of-the-art machine learning models with Transformers, for startup founders, with 161k+ GitHub stars.
161,315 stars33,421 forksPythonQuality 8/10Updated 6/5/2026100% free ยท open source
What it does
Transformers allows you to quickly define, train, and deploy state-of-the-art machine learning models for text, vision, and audio applications
Install / run
pip install transformers
When to use it
โขBuilding a chatbot that requires natural language processing
โขCreating a computer vision model for image classification
โขDeveloping an audio classification model for music or voice recognition
Quick start
1Import the library with `from transformers import AutoModelForSequenceClassification, AutoTokenizer`
2Load a pre-trained model and tokenizer with `model = AutoModelForSequenceClassification.from_pretrained('distilbert-base-uncased')` and `tokenizer = AutoTokenizer.from_pretrained('distilbert-base-uncased')`
3Prepare your dataset by tokenizing your text data with `inputs = tokenizer(text, return_tensors='pt')`
4Train your model with `outputs = model(**inputs)` and `loss = outputs.loss`
5Evaluate your model with `model.eval()` and `predictions = model(**inputs)`
Ready-to-paste prompt
python -c 'from transformers import pipeline; classifier = pipeline("sentiment-analysis"); print(classifier("I love this product!"))'
Heads up: Make sure you have the correct version of PyTorch or TensorFlow installed, as Transformers requires one of these frameworks to function, and check the GitHub README for specific version requirements
Saves to your device
Topics
audio
deep-learning
deepseek
gemma
glm
hacktoberfest
llm
machine-learning
model-hub
natural-language-processing
nlp
pretrained-models
python
pytorch
pytorch-transformers
qwen
speech-recognition
transformer
vlm
What's inside โ free to inspect
No purchase needed
Read the entire source before you build โ unlike paid marketplaces that hide it behind a buy button.