Skip to main content

A simple package to add a new parameter for the SentenceTransformer class

Project description

Callbackable Sentence Transformers

A simple class to replace the SentenceTransformer class from sentence_transformers package.

It adds a simple parameter callback_during_training to the SentenceTransformer.fit() function be able to get the loss value of the SentenceTransformer during training.

from callbackable_sentence_transformers import CallbackableSentenceTransformer

model = CallbackableSentenceTransformer(model_checkpoint)

def callback(loss, epoch, step):
    print(f"Loss at epoch {epoch}, {step}: {loss}")

model.fit(..., callback_during_training=callback)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page