Skip to content

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

alielfilali01
Copy link
Contributor

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 the community_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 all DEFAULT_SUITES (including custom and test) 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).

@alielfilali01
Copy link
Contributor Author

++ @clefourrier

@alielfilali01
Copy link
Contributor Author

@Winlere check this out if it works for you ?

@HuggingFaceDocBuilderDev
Copy link
Collaborator

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.

Copy link
Member

@NathanHB NathanHB left a 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.

@alielfilali01
Copy link
Contributor Author

@NathanHB i've added the commit with your suggestions.
Thanks

Comment on lines +224 to +176
tuple[list[str], dict[str, list[tuple[int, bool]]]]: A tuple containing:
- A sorted list of unique task names in the format "suite|task".
- A dictionary mapping each task name to a list of tuples representing the few_shot and truncate_few_shots values.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change ?

@NathanHB
Copy link
Member

need to fix styling and remove the docstring that changed and will merge :)

@clefourrier
Copy link
Member

One last nit, maybe add a kwarg like --with-community or --with-multilingual to list all tasks, so that people not wanting to get 74K lines of output can look at the other tasks

@alielfilali01 alielfilali01 force-pushed the alielfilali01-patch-1-fixTasksList branch from c7f6f4e to 34eba92 Compare August 18, 2025 11:25
@alielfilali01
Copy link
Contributor Author

@clefourrier , multilingual is always part of the lighteval suite. It will be hard to distinguish it !
maybe we can have a --suites arg which list only the passed suites ...
example: lighteval tasks list --suites helm,harness will only return back the help and harness tasks ...
WDYT ?

@clefourrier
Copy link
Member

clefourrier commented Aug 18, 2025

multilingual are not part of the core tasks of lighteval, as you need to install a specific set of dependencies for them (and therefore you should not change the pyproject.toml but test if the user has installed these deps when requesting multilingual tasks)

@clefourrier
Copy link
Member

clefourrier commented Aug 18, 2025

I like your idea of --suites, let's have the kwarg, but make it optional: if not selected, you get the core suites (helm, harness, lighteval, ...) , if selected and multilingual you test if the deps are there
Wdyt?

@alielfilali01 alielfilali01 force-pushed the alielfilali01-patch-1-fixTasksList branch from ddf1b03 to d0cd4c9 Compare August 18, 2025 11:47
refix the tasks list command
@clefourrier
Copy link
Member

need me to reopen it?

@alielfilali01
Copy link
Contributor Author

alielfilali01 commented Aug 18, 2025

Sorry guys, i've pushed from the wrong local directory which cuased an empty commit !
my local is a mess : )

@alielfilali01 alielfilali01 reopened this Aug 18, 2025
@clefourrier
Copy link
Member

np ^^

feat(tasks): add suite filtering and fix community task discovery

- Revert the community task path fix
- Add --suites parameter to lighteval tasks list
- Default to core suites only to prevent overwhelming output
- Add dependency checking for multilingual tasks
feat(tasks): add suite filtering and fix community task discovery

- Revert the community task path fix
- Add --suites parameter to lighteval tasks list
- Default to core suites only to prevent overwhelming output
- Add dependency checking for multilingual tasks
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.

4 participants