Description
-
sentence-transformers
version tested: 3.3 (branch: 3.3-release) -
Context: we are migrating a production pipeline that fine-tunes a model from
sentence-transformers
2.x to 3.x -
In 2.x we used the now deprecated method
model.fit()
as step toward 3.x we tested thefit()
method provided for backward compatibility. However, aRerankingEvaluator
we pass during training does not write thecsv
file with the metrics, as it did before. This file is very useful to us. -
Below my notes on the issue.
RerankingEvaluator
needs the output_path
to be set in order to write the csv file:
However, if my understanding is correct, in the fit_mixin.py
the class EvaluatorCallback
calls the evaluator
without passing the output_path
:
which causes that the file is not written to disk since output_path
is None
. Note that the flag write_csv: bool
is by default set to True
, which is the other condition for the RerankingEvaluator
to dump the file:
I think a possible fix would be to modify the call to the evaluator in fit_mixin.py
from
evaluator_metrics = self.evaluator(model, epoch=state.epoch)
to
evaluator_metrics = self.evaluator(model, epoch=state.epoch, output_path=args.output_dir)
I do understand this method is provided only to support the transition and it will be removed, but I think it would be nice to have it working as expected in the meantime :) .