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

Fail early on invalid metadata #1934

Merged
merged 2 commits into from
Jan 9, 2024
Merged

Conversation

Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Dec 21, 2023

Fix #1927.

If modelcard is invalid, we fail early instead of uploading all the LFS files before getting a bad request error on the /commit endpoint. This is slightly non-optimized since the model card is transferred twice to the Hub (once for check, once for commit) but by far better UX overall (avoid failing after minutes of waiting).

If modelcard is valid but some warnings have been raised, we print those warnings to the user but still continue. Example: empty metadata section.

@HuggingFaceDocBuilderDev

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

codecov bot commented Jan 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (36ad912) 82.44% compared to head (4e0ae75) 82.43%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1934      +/-   ##
==========================================
- Coverage   82.44%   82.43%   -0.01%     
==========================================
  Files          66       66              
  Lines        8138     8152      +14     
==========================================
+ Hits         6709     6720      +11     
- Misses       1429     1432       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

Sorry for the late review; looks good to me! Great to fail early here

@Wauplin
Copy link
Contributor Author

Wauplin commented Jan 9, 2024

No worries! Thanks for the review :)

@Wauplin Wauplin merged commit 54a35ac into main Jan 9, 2024
16 checks passed
@Wauplin Wauplin deleted the 1927-fail-early-on-invalid-metadata branch January 9, 2024 09:33
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.

Fail early if modelcard metadata is not correct on create_commit
3 participants