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

Use default model_name in metadata_update #1157

Merged
merged 5 commits into from
Nov 8, 2022

Conversation

lvwerra
Copy link
Member

@lvwerra lvwerra commented Nov 4, 2022

As reported by a user, the metadata_update does not work anymore (likely introduced in #940) if no "name" field in the "model-index" is provided. This breaks for example evaluate.push_to_hub where evaluation results are pushed to the hub.

With this PR the following behaviour is supported:

  • if "model-index" of new metadata has a "name" it is used (1)
  • if there is no "name"
    • if the existing repo card has one use this one (2)
    • else use the repo name as default (3)

Since the "name" is I think a little known feature of the PwC integration and providing a model name when pushing the results to a model repo seems a bit redundant I feel like having good defaults and not bother the user with it is a good idea. If you think this is a bad idea, we can throw an error in case (3).

cc @julien-c

@lvwerra lvwerra requested a review from Wauplin November 4, 2022 10:39
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Nov 4, 2022

The documentation is not available anymore as the PR was closed or merged.

@Wauplin
Copy link
Contributor

Wauplin commented Nov 4, 2022

I think a little known feature (...) I feel like having good defaults and not bother the user with it is a good idea.

To be honest, I don't know enough about metadata to really have an opinion on the "name" under "model-index". But I agree with you that in general we don't want to bother users about very specific features. I ping @nateraw would worked on that and might be more opinionated.


Otherwise, I noticed that for (3) you are talking about the repo name (e.g. "bart-base") and not the repo id (e.g. "facebook/bart-base"). I guess that's intended but wanted to highlight it for others in the discussion.

And also if we move forward on this PR, @lvwerra could you please add at least one test that triggers case (2) or (3) (e.g. a case that is currently broken but that your PR solves). Thanks in advance !

@lvwerra
Copy link
Member Author

lvwerra commented Nov 4, 2022

Yes, will add tests if people are happy with the suggested change, thanks @Wauplin!

Copy link
Member

@julien-c julien-c left a comment

Choose a reason for hiding this comment

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

personally I would use the full repo_id, but otherwise, lgtm!

lvwerra and others added 2 commits November 4, 2022 17:59
Co-authored-by: Julien Chaumond <julien@huggingface.co>
@lvwerra
Copy link
Member Author

lvwerra commented Nov 4, 2022

Sounds good, also added some tests :)

Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks for adding the test !
Please wait for @nateraw 's review before merging :)

@osanseviero osanseviero requested a review from nateraw November 7, 2022 02:46
@nateraw
Copy link
Contributor

nateraw commented Nov 7, 2022

Just getting to his ( was off on Friday ). Having a look!

@nateraw
Copy link
Contributor

nateraw commented Nov 7, 2022

personally I would use the full repo_id, but otherwise, lgtm!

Agree with repo ID but I'm not too opinionated

Copy link
Contributor

@nateraw nateraw left a comment

Choose a reason for hiding this comment

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

LGTM thanks for the update. One concern is that we do mention this required name in the docs for model card.

Do we need to update the docstring around this? Mentioned in eval_result kwarg docstring as well.

@nateraw
Copy link
Contributor

nateraw commented Nov 7, 2022

Thanks for docstring update. ❤️

once quality tests/other tests pass this is good to go I think :)

@codecov
Copy link

codecov bot commented Nov 7, 2022

Codecov Report

Base: 84.54% // Head: 84.70% // Increases project coverage by +0.16% 🎉

Coverage data is based on head (4d46b7e) compared to base (e646412).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1157      +/-   ##
==========================================
+ Coverage   84.54%   84.70%   +0.16%     
==========================================
  Files          42       42              
  Lines        4147     4184      +37     
==========================================
+ Hits         3506     3544      +38     
+ Misses        641      640       -1     
Impacted Files Coverage Δ
src/huggingface_hub/repocard_data.py 98.41% <ø> (+0.02%) ⬆️
src/huggingface_hub/repocard.py 95.72% <100.00%> (+1.73%) ⬆️
src/huggingface_hub/utils/_deprecation.py 95.55% <0.00%> (-4.45%) ⬇️
src/huggingface_hub/hf_api.py 87.56% <0.00%> (-0.04%) ⬇️
src/huggingface_hub/file_download.py 88.48% <0.00%> (+0.60%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Wauplin
Copy link
Contributor

Wauplin commented Nov 8, 2022

I'm finally merging the PR. Thanks @lvwerra for all the modifications ! :)

@Wauplin Wauplin merged commit 9735536 into main Nov 8, 2022
@Wauplin Wauplin deleted the fix-update-metadata-missing-name branch November 8, 2022 08:08
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.

5 participants