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

Feature: add community metrics #4

Closed
lvwerra opened this issue Apr 6, 2022 · 6 comments
Closed

Feature: add community metrics #4

lvwerra opened this issue Apr 6, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@lvwerra
Copy link
Member

lvwerra commented Apr 6, 2022

We would like a way for community members to easily add custom or new metrics. These custom metrics could be hosted on the hub either in a dedicated repository type (like datasets or models) or on Spaces.

Spaces comes with a few advantages, especially in short term:

  1. No dedicated repo type needed
  2. Infrastructure already exists
  3. We can easily setup a demo without needing a custom widget (e.g. with Gradio)

@osanseviero made a PoC here: https://huggingface.co/spaces/osanseviero/accuracy_metric

A few things that we should add to make this as user friendly and useful as possible:

  • create a template to add a metric space
    • template README.md (like model/dataset card) with basic structure
    • template my_metric.py file (similar to datasets loading scripts)
    • gradio app.py that loads all information from README.md and my_metric.py to create a default widget. This does probably not need to be changed.
  • debugging tools
    • instructions on how to clone the repository directly on spaces
    • maybe an evaluate-cli command to test if everything is fine evaluate-cli test-metric PATH_TO_REPO
  • dedicated tag: if we ever want to migrate the metrics to a dedicated place like datasets and models it is good if we had a tag to find them all. Similarly, we could then easily do a list_metrics() function in the evaluate without needing to look at the content of each repo.

The goal is to enable behaviour (example with the space above):

accuracy_metric = load_metric("osanseviero/accuracy_metric")
@lvwerra lvwerra added the enhancement New feature or request label Apr 6, 2022
@osanseviero
Copy link
Member

Also cc @julien-c

@julien-c
Copy link
Member

julien-c commented Apr 6, 2022

maybe just name the file metric.py, or embed it directly into the app.py

dedicated tag

Yes, you can just add a tags: - metric to the README.md

@lvwerra
Copy link
Member Author

lvwerra commented Apr 7, 2022

Thanks, that's a good idea. Maybe we keep metric.py and app.py separated in case we want to switch the widget or metric logic at some point we don't need to touch/disentangle both.

@julien-c
Copy link
Member

julien-c commented Apr 7, 2022

Yes, you can just add a tags: - metric to the README.md

To clarify: I think there is a small thing left to implement in moon-landing (cc @cbensimon) but then you will be able to query https://hf.co/api/spaces?filter=metric i.e. same as for other repo types

But in the meantime you can already add tags to README.md "space cards"

@osanseviero
Copy link
Member

Agree these should be two separate files. If you want to use a metric on the hub, you should just need to download app.py (and maybe something related to dependencies)

@lvwerra
Copy link
Member Author

lvwerra commented May 11, 2022

Closed with #25 and #14.

@lvwerra lvwerra closed this as completed May 11, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants