-
Notifications
You must be signed in to change notification settings - Fork 570
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
Add Hub verification token to evaluation metadata #1142
Conversation
The documentation is not available anymore as the PR was closed or merged. |
src/huggingface_hub/repocard_data.py
Outdated
verified: Optional[bool] = None | ||
|
||
# Generated by Hugging Face to verify the results are valid. | ||
verifyToken: Optional[str] = None |
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.
I use camelCase here because that's what's implemented on the Hub side: https://github.com/huggingface/moon-landing/pull/4037/files#diff-e9eafbf94fe033bdaf22611fa3eab89f02aa8776685889dd5cace85d7ed82257R82
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.
@lewtun Sorry to ask for a last change but would it be possible to use snake_case here ? I think keeping consistency within the hfh
parameters is more important than keeping consistency with the server naming.
This would require to change both the getter and the setter in
# in model_index_to_eval_results
verify_token = metric.get("verifyToken")
(...)
verify_token=verify_token,
and
# in eval_results_to_model_index
"verifyToken": result.verify_token,
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.
Is the
or similar would make more sense, rather than supporting setting verified tokens out of the box |
We currently rely on the If desired, we could roll our own version of this function using the commit API functions in |
hmm yeah i think this should live in internal code (wdyt also @coyotte508 @allendorf?) |
IMO Take this with a grain of salt, I'm only a little familiar with the hub library and not at all with how metadata is used in its scope. |
I would be of @coyotte508 's opinion, at least if I understand correctly what this token is. For what I have read in https://github.com/huggingface/moon-landing/issues/3263 (and more precisely https://github.com/huggingface/moon-landing/issues/3263#issuecomment-1239320855) (internal links), we want to generate a token that proves the metrics have been verified by HF and we want this token to be public so that everyone can check it is a valid one, right ? If that's the case, I'd definitely be ok to have them in |
Yes, |
Ok i hadn't actually read the code so i thought the signing code was here (which wouldn't make sense IMO) Yes the types in Up to you |
Agree that |
(@lewtun I have just merged main in your branch to make the CI pass. You need to do a |
Codecov ReportBase: 84.61% // Head: 84.63% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1142 +/- ##
==========================================
+ Coverage 84.61% 84.63% +0.01%
==========================================
Files 41 41
Lines 4096 4100 +4
==========================================
+ Hits 3466 3470 +4
Misses 630 630
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. |
Co-authored-by: Lucain <lucainp@gmail.com>
@Wauplin thanks for the reviews - I think this should be good to go once the CI runs. Let me know if you want any more changes :) |
@lewtun sorry I just added a last comment in #1142 (comment) and then we should be good to go I think. Thanks in advance 🙏 |
@@ -91,6 +91,8 @@ def test_model_index_to_eval_results(self): | |||
{ | |||
"type": "acc", | |||
"value": 0.9, | |||
"verified": True, |
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.
I found it useful to add this info to the unit test to be sure that these new fields are behaving as expected
@Wauplin thanks for the snake_case feedback - should now be fixed and ready to go if the CI passes :) |
Perfect ! Thanks @lewtun for taking care of all the details :) 🔥 |
This PR adds a new
verifyToken
field to the evaluation metadata schema to enable the Hub to verify whether evaluation results come from Hugging Face's evaluation service vs self-reported.This is need to enable the following PRs:
Note: I'm not sure what's the best practice to handle camelCase fields in Python codebases, so please let me know if I should refactor variable names :)