weavel-ai / Ape

Your first AI prompt engineer
https://docs.weavel.ai/sdk-reference/ape-common
MIT License
331 stars 13 forks source link

fix: fix bugs in trainer #39

Closed engineerA314 closed 1 week ago

engineerA314 commented 1 week ago

Description

This pull request addresses several bugs and improvements in various trainer classes within the APE Core library. The main changes include:

  1. Adding a best_score attribute to all trainer report classes in types/report.py.
  2. Fixing logger usage in DspyMiproTrainer by importing and using the global logger.
  3. Updating the train method in ExpelTrainer, FewShotTrainer, and TextGradientTrainer to properly set the best_score in their respective reports.
  4. Modifying the TextGradientTrainer to handle early stopping when the score reaches 1.0, with different behavior based on the validation type.
  5. Updating the OptunaTrainer to set the best_score in the report after optimization.

These changes aim to improve consistency across trainer implementations and provide more accurate reporting of training results.

Test

N/A

Changes that Break Backward Compatibility

The addition of the best_score attribute to all trainer report classes in types/report.py may potentially break backward compatibility for code that relies on the previous structure of these report classes. Users of the library may need to update their code to handle this new attribute.

Documentation

N/A

Created with Palmier

aschung01 commented 1 week ago

@palmier-bot describe