-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Easier unitxt tasks loading and removal of unitxt library dependancy #1933
Easier unitxt tasks loading and removal of unitxt library dependancy #1933
Conversation
Signed-off-by: Elron Bandel <[email protected]>
Signed-off-by: Elron Bandel <[email protected]>
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.
Hi @elronbandel , thank you for this PR!
Just 2 small points before we can merge:
- made a comment about naming conventions for unitxt tasks: which do you prefer?
- +1 to testing the small change in
__init__.py
on some of the other Python tasks in the repo if possible:squad_completion
,fda
,swde
would be some nice tasks to test this on.
… the constructor Signed-off-by: Elron Bandel <[email protected]>
Thank you for reviewing my PR so quickly @haileyschoelkopf @LSinev!
|
I believe, one should proactively find every task affected by this small change in |
@LSinev Do you think it might be safer to use this function: import inspect
def has_config_in_constructor(cls):
"""
Determines whether the constructor of the provided class has a parameter named 'config'.
Args:
cls (type): The class to be inspected.
Returns:
bool: True if the 'config' parameter exists in the constructor, False otherwise.
"""
constructor = getattr(cls, '__init__', None)
return 'config' in inspect.signature(constructor).parameters if constructor else False Then conditioning on it: if has_config_in_constructor(config["class"]):
task = config["class"](config=config)
else:
task = config["class"]() |
This Idea behind changing all python tasks in this repo accordingly is not only fully-working repo, but also providing useful and working examples for new task creators. With Thus said, easying unitxt tasks loading may cause too many improvements in all repo, or may be it will be easier to convert unitxt to ConfigurableTask and improve config options through this class. |
Signed-off-by: elronbandel <[email protected]>
Signed-off-by: elronbandel <[email protected]>
Signed-off-by: elronbandel <[email protected]>
Signed-off-by: elronbandel <[email protected]>
Signed-off-by: elronbandel <[email protected]>
Current change:
Details: Fixing tasks using "class: !function" By running We get everything need to be updated:
All the classes can be tested end to end with:
Similarly when I revert the change in squad_completion as an example I still get the same result:
This verifies that we have full backward computability. |
I will look at this today @elronbandel , sorry for letting it sit so long! |
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.
@elronbandel the PR looks good to me!
We're just finishing up a couple loose ends on #1741 and will have that merged either later today or, at worst by the weekend due to the US holiday tomorrow (the PR is ready, we're just confirming some behavior changes with task authors).
I'm intending to merge this PR after fixing up merge conflicts and retesting here, as soon as that other one goes though.
Merged into main ; last test failure is just due to tests not installing optional deps for unitxt metrics! LGTM, thanks @elronbandel ! |
Easier loading for our lm-eval-harness users. This has significant importance for our user base and can allow us to bring more users to the lm-eval-harness platform.