SetFit v1.0.0 Migration Guide

To update your code to work with v1.0.0, the following changes must be made:

General Migration Guide

  1. keep_body_frozen from SetFitModel.unfreeze has been deprecated, simply either pass "head", "body" or no arguments to unfreeze both.
  2. SupConLoss has been moved from setfit.modeling to setfit.losses. If you are importing it using from setfit.modeling import SupConLoss, then import it like from setfit import SupConLoss now instead.
  3. use_auth_token has been renamed to token in SetFitModel.from_pretrained(). use_auth_token will keep working until the next major version, but with a warning.

Training Migration Guide

  1. Replace all uses of SetFitTrainer with Trainer, and all uses of DistillationSetFitTrainer with DistillationTrainer.

  2. Remove num_iterations, num_epochs, learning_rate, batch_size, seed, use_amp, warmup_proportion, distance_metric, margin, samples_per_label and loss_class from a Trainer initialization, and move them to a TrainerArguments initialization instead. This instance should then be passed to the trainer via the args argument.

  3. Stop providing training arguments like num_epochs directly to Trainer.train: pass a TrainingArguments instance via the args argument instead.

  4. Refactor multiple trainer.train(), trainer.freeze() and trainer.unfreeze() calls that were previously necessary to train the differentiable head into just one trainer.train() call by setting batch_size and num_epochs on the TrainingArguments dataclass with tuples. The first value in the tuple is for training the embeddings, and the second is for training the classifier.

Hard deprecations

v1.0.0 Changelog

This list contains new functionality that can be used starting from v1.0.0.