-
Notifications
You must be signed in to change notification settings - Fork 322
fix tasks list #906
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
base: main
Are you sure you want to change the base?
fix tasks list #906
Conversation
add `langcodes` for the multilingual extra group
feat(tasks): Enhance task discovery and display This commit improves the task registry to ensure all available task suites, including community, multilingual, custom, and test suites, are correctly discovered and displayed in the `lighteval tasks list` command.
++ @clefourrier |
@Winlere check this out if it works for you ? |
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
# Community tasks are in the lighteval directory, not under src | ||
import sys | ||
import os | ||
community_path = os.path.join(os.path.dirname(__file__), "..", "..", "..", "community_tasks") |
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.
community_path = os.path.join(os.path.dirname(__file__), "..", "..", "..", "community_tasks") | |
community_path = Path(__file__).parent.parent.parent / "community_tasks" |
import sys | ||
import os |
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.
they should be imported at the top of the file.
import sys | ||
import os | ||
community_path = os.path.join(os.path.dirname(__file__), "..", "..", "..", "community_tasks") | ||
if os.path.exists(community_path): |
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.
if os.path.exists(community_path): | |
if not community_path.exists(): |
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.
Thanks for the PR !
Overall looks good, i tested it and it works great. Only thing would be to make the code clearer and using pathlib would be cleaner here.
feat(tasks): Enhance task discovery and display. Bug mentioned here: #903
This PR improves the task registry to ensure all available task suites, including community, custom, test suites ... are correctly discovered and displayed in the
lighteval tasks list
command.The key changes include:
Dynamic Community Task Loading: the new function (
load_community_tasks
) is to dynamically scan thecommunity_tasks
directory and load any valid task modules. This process is resilient, as it gracefully handles and logs errors for any malformed task files without interrupting the loading of others.Lazy Loading for Multilingual Tasks: The import for multilingual tasks is now deferred until the task registry is accessed. This prevents crashes when optional dependencies (like
langcodes
) are not installed and instead logs a helpful warning.Comprehensive Suite Display: The
print_all_tasks
function has been updated to guarantee that allDEFAULT_SUITES
(includingcustom
andtest
) are always visible in the output, even if they contain no tasks. A "(no tasks in this suite)" message is now shown for empty suites to improve clarity.These changes provide a more robust and complete discovery mechanism, giving users a reliable view of all available tasks in
lighteval
.Before these changes, the command
lighteval tasks list
used to return about 1500 lines (tasks).After these changes, the command
lighteval tasks list
now returns more than 74200 lines (tasks).