Name the method on the uploaded model card - #10816
Conversation
upload_to_huggingface takes `method` as a required positional argument and then
formats the card with method = "". MODEL_CARD's heading is
# Uploaded {method} model
so every card it pushes reads "Uploaded model", with the gap where the method
should be. All four call sites in save.py pass "finetuned".
Pass the argument through. Studio's copy of the same template already does this,
with `method = compressed_alias or format_type`.
Test: tests/test_upload_model_card_method.py lifts MODEL_CARD and
upload_to_huggingface out with ast and runs them against a recording ModelCard,
the way tests/test_merged_hub_destination.py does, since save.py cannot be
imported without an accelerator. It asserts the heading names the method, and a
second test pins that the username, extra tag and datasets still come through.
The first fails on main.
for more information, see https://pre-commit.ci
|
Confirmed the heading in unsloth/save.py:2579 still gets an empty method at line 2687, so uploaded cards come out with the gap in them. Will get this reviewed, and please take a look at the Repo tests (CPU) job on your branch. |
|
Looked at it. The failure is not from this PR: The test asserts the old inlined expression: assert "aria-hidden={(hasPinMode && !pinned && collapseToZero) || undefined}" in primitive
const holdsOut = hasPinMode && !pinned && collapseToZero
const heldOut = holdsOut && peeking
...
aria-hidden={(holdsOut && !heldOut) || undefined}
inert={(holdsOut && !heldOut) || undefined}So the behaviour the test is guarding is still there, the string it greps for is not. Held out, the sidebar is on screen and must answer the pointer, which is the Happy to send a one-line update to that assertion as its own PR if you want it, since it is blocking the CPU job on every open PR right now. Keeping it out of this one. |
What breaks
upload_to_huggingfacetakesmethodas a required positional argument and then throws it away:MODEL_CARD's heading is# Uploaded {method} model, so every card this pushes comes out as:with the gap still in it. All four call sites in
save.pypass"finetuned", so that is what should be there.Why it is a bug and not a choice
Studio carries the same template and fills the placeholder in:
method = compressed_alias or format_typeinstudio/backend/core/export/export.py. Its heading is# Uploaded finetuned {method} model. The placeholder is meant to carry a value.What changed
One line: pass
methodthrough. The heading now reads# Uploaded finetuned model.Tests
tests/test_upload_model_card_method.pyliftsMODEL_CARDandupload_to_huggingfaceout withastand runs them against a recordingModelCard, the waytests/test_merged_hub_destination.pydoes, becausesave.pycannot be imported without an accelerator.# Uploaded modelextratag anddatasetsstill reach the cardThe first fails on main:
Left alone
create_huggingface_repoand_push_merged_to_hub_revisionalso format the card withmethod = "", and both print the same double space. Neither has a method to name, so fixing that means deciding what those two flows should be called. Happy to do it in a follow-up if you want a value there.