-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds ability to use functions for prompt definition #207
Conversation
@@ -61,6 +61,8 @@ | |||
if TYPE_CHECKING: | |||
from lighteval.logging.evaluation_tracker import EvaluationTracker | |||
|
|||
FormatterType = Callable[[dict, str], Doc] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you include a string?
I don't see which prompt formater takes a string as input
@@ -149,6 +151,38 @@ def __post_init__(self): | |||
self.stop_sequence = tuple(self.stop_sequence) if self.stop_sequence is not None else None | |||
|
|||
|
|||
def load_prompt_function(prompt_function: str, custom_tasks_module: list | None) -> FormatterType: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally find it less readable with a custom type, we'll see if we keep it through time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
I've actually updated this PR in #213 to get an homogeneous system, closing this one to avoid merging it accidentally |
For python based config, it's way more desirable to use the prompt functions directly instead of passing a string.
MISC:
updates the ruff version in pre-commit to match the pyproject one.