Registry / ai-ml / simpletransformers

simpletransformers

JSON →
library0.70.8pypypiunverified

Simple Transformers is an easy-to-use wrapper library for the Transformers library, providing a unified API for training and using transformer models for NLP tasks such as classification, NER, QA, LM, etc. Current version is 0.70.8, released in 2022. Development is in maintenance mode with infrequent updates.

pip install simpletransformers
INSTALL
IMPORT
SIG · SIMPLETRANSFORMERS
S
simpletransformers
ai-mlpythonv0.70.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ClassificationModel
from simpletransformers import ClassificationModel
from simpletransformers.classification import ClassificationModel

Minimal example: train a DistilBERT classifier and predict. Set use_cuda=False if no GPU.

from simpletransformers.classification import ClassificationModel import pandas as pd # Prepare data train_data = [ ["I love this product!", 1], ["This is terrible.", 0], ] train_df = pd.DataFrame(train_data, columns=["text", "labels"]) # Initialize model (uses distilbert by default) model = ClassificationModel( "distilbert", "distilbert-base-uncased", use_cuda=False, args={"num_train_epochs": 1, "no_save": True}, ) # Train model.train_model(train_df) # Predict predictions, raw_outputs = model.predict(["Great product!"],) print(predictions)
Debug
Known issues
breakingImport paths changed from top-level to submodule imports in v0.65+. Direct imports like `from simpletransformers import ClassificationModel` no longer work.
fix
Use from simpletransformers.classification import ClassificationModel.
affects: >=0.65.0
deprecatedThe argument `num_labels` is deprecated. Use `labels_list` in args to specify label mapping.
fix
Set args={'labels_list': [0, 1]} instead of passing num_labels to model constructor.
affects: >=0.65.0
gotchaWhen using a custom model path, set `model_type` correctly (e.g., 'bert', 'roberta') otherwise model loading silently fails or uses wrong architecture.
fix
Check HuggingFace model type and pass matching `model_type` string.
affects: all
gotchaTraining may hang or crash if `use_cuda` is set to True but no GPU is available. The library does not always fall back to CPU gracefully.
fix
Set `use_cuda=False` explicitly in non-GPU environments, or detect GPU availability.
affects: all
breakingThe `wandb_project` argument no longer works; wandb must be configured externally using `wandb.init()`.
fix
Initialize wandb before creating the model: import wandb; wandb.init(project='my_project').
affects: >=0.65.0
gotchaData format changed: classification models now expect a pandas DataFrame with columns 'text' and 'labels'. Using lists or dictionaries may raise errors.
fix
Convert your data to a DataFrame: pd.DataFrame({'text': [...], 'labels': [...]}).
affects: >=0.65.0
Upgrade
Version history
0.70.8latest on PyPI · released May 31, 2026
Audit
Dependencies
transformersrequiredCore dependency for all transformer models.
torchoptionalRequired for PyTorch backend.
tensorflowoptionalOptional TensorFlow backend.
seqevaloptionalRequired for NER evaluation metrics.
scikit-learnrequiredUsed for classification metrics.
Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
simpletransformers — pip install simpletransformers · libregistry