Download Latest Version v1.1.2 source code.tar.gz (25.2 MB)
Email in envelope

Get an email when there's a new version of SetFit

Home / v1.1.1
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2025-01-13 2.9 kB
v1.1.1 source code.tar.gz 2025-01-13 25.2 MB
v1.1.1 source code.zip 2025-01-13 25.3 MB
Totals: 3 Items   50.5 MB 0

This is a patch release with two notable fixes:

  • Compatibility with transformers v4.45.2 is introduced; tested up to v4.48.0, including support for finetuning with ModernBERT, e.g. nomic-ai/modernbert-embed-base (see [#577])
  • Prevent report_to="none" in the TrainingArguments from being ignored (see [#570])
Click to expand a ModernBERT training script :::python from datasets import load_dataset from setfit import SetFitModel, Trainer, TrainingArguments # Load a dataset from the Hugging Face Hub dataset = load_dataset("sst2") # Simulate the few-shot regime by sampling 8 examples per class train_dataset = dataset["train"].select(range(200)) eval_dataset = dataset["validation"].select(range(200)) test_dataset = dataset["validation"].select(range(200, len(dataset["validation"]))) # Load a SetFit model from Hub model = SetFitModel.from_pretrained( "nomic-ai/modernbert-embed-base", labels=["negative", "positive"], ) # Train for 100 steps; log, evaluate (with 100 steps) args = TrainingArguments( batch_size=16, max_steps=100, logging_steps=10, eval_strategy="steps", eval_steps=10, eval_max_steps=100, save_total_limit=-1, ) trainer = Trainer( model=model, args=args, train_dataset=train_dataset, eval_dataset=eval_dataset, metric="accuracy", column_mapping={"sentence": "text", "label": "label"} ) # Train and evaluate trainer.train() metrics = trainer.evaluate(test_dataset) print(metrics) # {'accuracy': 0.9092261904761905} preds = model.predict(["I loved the spiderman movie!", "Pineapple on pizza is the worst 🤮"]) print(preds) # ['positive', 'negative']

What's Changed

New Contributors

Full Changelog: https://github.com/huggingface/setfit/compare/v1.1.0...v1.1.1

Source: README.md, updated 2025-01-13