Skip to content

Conversation

blawney
Copy link

@blawney blawney commented May 15, 2025

Addresses a minor issue related to the deprecation of sentence_transformers.model_card.ModelCardCallback. This has since been changed to sentence_transformers.model_card.SentenceTransformerModelCardCallback and the PR will catch either object type.

I initially encounted a bug when I had setfit==1.1.1 with sentence-transformers==4.1.0 (which resulted from an "unversioned" mamba-based build). Prior to #595 (as is the case for v1.1.1), there was an instance of sentence_transformers.model_card.SentenceTransformerModelCardCallback which was added by the add_model_card_callback method in the sentence_transformers.SentenceTransformerTrainer class. Since the object type did not match sentence_transformers.model_card.ModelCardCallback (aliased as STModelCardCallback in setfit/trainer.py), the callback was not removed and a call to the setfit.Trainer constructor resulted in this:

TypeError: SentenceTransformerModelCardCallback.on_init_end() missing 1 required positional argument: 'trainer'

Note that this is no longer an issue with setfit==1.1.2, yet this PR addresses the potential where either the current or deprecated callback makes its way into setfit.trainer.BCSentenceTransformersTrainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant