Skip to content

RerankingEvaluator does not write the csv file when the backward compatible fit() method is used. Possible fix suggested. #3062

Closed
@bluebalam

Description

@bluebalam
  • 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 the fit() method provided for backward compatibility. However, a RerankingEvaluator we pass during training does not write the csv 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:

if output_path is not None and self.write_csv:

However, if my understanding is correct, in the fit_mixin.py the class EvaluatorCallback calls the evaluator without passing the output_path :

evaluator_metrics = self.evaluator(model, epoch=state.epoch)

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:

if output_path is not None and self.write_csv:
.

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 :) .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions