Skip to content
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

Pass metric init_kwargs from the Evaluators to metrics #351

Conversation

NimaBoscarino
Copy link
Contributor

Some metrics require arguments an init-time to load them appropriately, such as the HONEST metric. This PR adds a metric_init_kwargs option to the base Evaluator, which then passes those down through to the load_metric method.

Not quite sure what the best way to write test for this is, since there isn't a suite specifically for the base evaluator. Let me know if you have any suggestions!

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Nov 9, 2022

The documentation is not available anymore as the PR was closed or merged.

@lvwerra
Copy link
Member

lvwerra commented Nov 10, 2022

You can pass an already loaded metric to the evaluator - wouldn't that solve this issue?

@NimaBoscarino
Copy link
Contributor Author

NimaBoscarino commented Nov 10, 2022

Ah good point, I should've clarified – this is specifically to make the eventual Evaluation Suite (#337) easier to use. Originally I'd done this for the JSON-only version of the Evaluation Suite (#302) since there wasn't a way to pass init_kwargs to metrics there, but even with the suite-as-code version it's still a bit awkward to have to load metrics above the suite and then pass them down.

Especially if I have multiple tasks to run that need the same metric, but with different configurations on it, I'd end up having to load multiple versions of the metric and I'd have to come up with a number of different variable names, which makes the resulting code confusing to look at IMO.

EDIT: I guess the other option is to have the Evaluation Suite receive the metric_init_kwargs and load the metric in there before calling task_evaluator.compute.

@lvwerra
Copy link
Member

lvwerra commented Nov 14, 2022

If we need a metric with custom init args we could pass them in the SubTask definition, right? E.g.
"metric": evaluate.load("metric", important_setting=1) (doesn't need to be a string). I think it would be good to keep the signature of EvaluationSuite and Evaluator as clean as possible and if there is already way to achieve the goal then we shouldn't create multiple ways to do the same thing. That being said, if it's a blocker for something you want to do we can add it :)

@NimaBoscarino
Copy link
Contributor Author

Oh good point, I hadn't considered passing something other that a dict of strings to args_for_task 😅 I'll try that out, and if it looks like it works alright then I'll close this PR.

@NimaBoscarino
Copy link
Contributor Author

Confirmed! Doing it that way works, so this PR isn't needed. Closing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants