{"id":46389,"library":"simpletransformers","title":"Simple Transformers","description":"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.","status":"maintenance","version":"0.70.8","language":"python","source_language":"en","source_url":"https://github.com/ThilinaRajapakse/simpletransformers","tags":["nlp","transformers","huggingface","classification","ner","question-answering"],"install":[{"cmd":"pip install simpletransformers","lang":"bash","label":"Default install"},{"cmd":"pip install simpletransformers[all]","lang":"bash","label":"Install with all extras"}],"dependencies":[{"reason":"Core dependency for all transformer models.","package":"transformers","optional":false},{"reason":"Required for PyTorch backend.","package":"torch","optional":true},{"reason":"Optional TensorFlow backend.","package":"tensorflow","optional":true},{"reason":"Required for NER evaluation metrics.","package":"seqeval","optional":true},{"reason":"Used for classification metrics.","package":"scikit-learn","optional":false}],"imports":[{"wrong":"from simpletransformers.classification import ClassificationModel","symbol":"ClassificationModel","correct":"from simpletransformers import ClassificationModel"}],"quickstart":{"code":"from simpletransformers.classification import ClassificationModel\nimport pandas as pd\n\n# Prepare data\ntrain_data = [\n    [\"I love this product!\", 1],\n    [\"This is terrible.\", 0],\n]\ntrain_df = pd.DataFrame(train_data, columns=[\"text\", \"labels\"])\n\n# Initialize model (uses distilbert by default)\nmodel = ClassificationModel(\n    \"distilbert\",\n    \"distilbert-base-uncased\",\n    use_cuda=False,\n    args={\"num_train_epochs\": 1, \"no_save\": True},\n)\n\n# Train\nmodel.train_model(train_df)\n\n# Predict\npredictions, raw_outputs = model.predict([\"Great product!\"],)\nprint(predictions)","lang":"python","description":"Minimal example: train a DistilBERT classifier and predict. Set use_cuda=False if no GPU."},"warnings":[{"fix":"Use from simpletransformers.classification import ClassificationModel.","message":"Import paths changed from top-level to submodule imports in v0.65+. Direct imports like `from simpletransformers import ClassificationModel` no longer work.","severity":"breaking","affected_versions":">=0.65.0"},{"fix":"Set args={'labels_list': [0, 1]} instead of passing num_labels to model constructor.","message":"The argument `num_labels` is deprecated. Use `labels_list` in args to specify label mapping.","severity":"deprecated","affected_versions":">=0.65.0"},{"fix":"Check HuggingFace model type and pass matching `model_type` string.","message":"When using a custom model path, set `model_type` correctly (e.g., 'bert', 'roberta') otherwise model loading silently fails or uses wrong architecture.","severity":"gotcha","affected_versions":"all"},{"fix":"Set `use_cuda=False` explicitly in non-GPU environments, or detect GPU availability.","message":"Training 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.","severity":"gotcha","affected_versions":"all"},{"fix":"Initialize wandb before creating the model: import wandb; wandb.init(project='my_project').","message":"The `wandb_project` argument no longer works; wandb must be configured externally using `wandb.init()`.","severity":"breaking","affected_versions":">=0.65.0"},{"fix":"Convert your data to a DataFrame: pd.DataFrame({'text': [...], 'labels': [...]}).","message":"Data format changed: classification models now expect a pandas DataFrame with columns 'text' and 'labels'. Using lists or dictionaries may raise errors.","severity":"gotcha","affected_versions":">=0.65.0"}],"env_vars":null,"search_vec":"'0.70.8':40 '2022':43 'answer':59 'api':20 'classif':32,55 'current':37 'develop':44 'easi':8 'easy-to-us':7 'etc':36 'huggingfac':54 'infrequ':50 'librari':12,16 'lm':35 'mainten':47 'mode':48 'model':26 'ner':33,56 'nlp':28,52 'provid':17 'qa':34 'question':58 'question-answ':57 'releas':41 'simpl':1,3 'task':29 'train':22 'transform':2,4,15,25,53 'unifi':19 'updat':51 'use':10,24 'version':38 'wrapper':11","created_at":"2026-06-07T12:59:41.666144+00:00","updated_at":"2026-06-07T12:59:41.666144+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nImportError: cannot import name 'ClassificationModel' from 'simpletransformers' (/tmp/tmpvacak9b7/venv/lib/python3.12/site-packages/simpletransformers/__init__.py)"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/ThilinaRajapakse/simpletransformers/","github":"https://github.com/ThilinaRajapakse/simpletransformers/","docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}