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

Support custom results/details push to hub #457

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

Conversation

albertvillanova
Copy link
Member

@albertvillanova albertvillanova commented Dec 18, 2024

Support custom results/details push to hub.

This PR add 2 new methods (push_results_to_hub and push_details_to_hub) to allow the user to push results/details to the Hub in a completely customizable way (fully managed by the user).

The user can still call the old push_to_hub method to have it fully managed by the library.

TODO:

  • Docstrings

@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.

@@ -281,6 +303,31 @@ def push_to_hub(

self.recreate_metadata_card(repo_id)

def push_results_to_hub(self, repo_id: str, path_in_repo: str, private: bool | None = None):
Copy link
Member

Choose a reason for hiding this comment

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

Please add some doc, especially to explain the mechanism for the args you added (as they over-write some defaults set at the class level).

Copy link
Member

Choose a reason for hiding this comment

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

Edit: just saw they were in your todo :)

@@ -281,6 +303,31 @@ def push_to_hub(

self.recreate_metadata_card(repo_id)

def push_results_to_hub(self, repo_id: str, path_in_repo: str, private: bool | None = None):
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't repo_id be results by default ?

Copy link
Member

Choose a reason for hiding this comment

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

Same for path_in_repo - do we want to follow as default what we had? (org/modelname/results_date.json)

self.api.upload_file(
repo_id=repo_id,
path_or_fileobj=details_json.encode(),
path_in_repo=path_in_repo.format(task_name=task_name),
Copy link
Member

Choose a reason for hiding this comment

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

Can you provide an example of the expected path_in_repo ?

@clefourrier
Copy link
Member

clefourrier commented Dec 26, 2024

We would also want push_to_hub to use the above 2 functions to avoid logic duplication risk

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