feat(upload): add --dry-run, and let --card-only work without local weights - #70
Merged
Conversation
…eights Preparing to refresh published cards showed three things missing for that to be done safely. - `--dry-run` renders the card, diffs it against the published one, counts the lines that would be REMOVED, and stops. Losing content is the failure mode here — a value that exists only in the published README — so the dry run names it rather than reporting success. - `--card-only` refused to run without local .safetensors, though it pushes only the README and the manifest. Refreshing a card required keeping the weights on disk, which is why 20 of the 21 published cards could not be touched at all. - In --card-only the file listing now comes from the remote alone. Merging the local directory over it published sizes from a build that is not the one in the repo: models/ernie-image-pe-mlx holds a 7.14 GB pe.safetensors while the repo has 6.39 GB. With these, all twelve lossless repos dry-run clean: three change nothing, five differ by a blank line, ltx-2.3 gains the two delta-uploaded files its card never mentioned, and matrix-game gains its four tokenizer files. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TaEHdLNyZuqjxqGmZ73JG9
Refreshing dgrauet/matrix-game-3.0-mlx published a card WITHOUT its Related Projects section and without the tokenizer files the dry run had just shown being added. The card was restored from the previous revision. Cause: two generation sites. The CLI assembled the card from the manifest, the recipe declaration, the remote file listing and the operator's flags — then upload_model(card_only=True) threw that away and regenerated from the manifest alone, without listing, links, license or snippet. --dry-run stopped at the first, so it faithfully displayed a card that was never the one uploaded. - upload_model now pushes the README on disk and refuses if there is none. It builds nothing. - Deriving transformer variants and LoRAs from the remote moves into the CLI, next to everything else the card needs. - The dry run's loss warning pairs a removed entry with its replacement, so a file whose size changed no longer reads as content disappearing. A warning that cries wolf is worse than none. Tests moved to the level that now owns the behaviour: the CLI assembles, upload_model transports. One asserts every line the dry run announces appears in the bytes a real run pushes — the property that was violated. Verified by reintroducing the second generation: four tests fail. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TaEHdLNyZuqjxqGmZ73JG9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Preparing to refresh the published cards showed three things missing for that to be done safely. Each was found by trying to do the thing, not by reading the code.
1.
--dry-runRenders the card, diffs it against the published one, counts the lines that would be removed, and stops. Losing content is the failure mode in this area, so the dry run names it instead of reporting success:
It immediately caught something else:
mlx-forge upload models/ernie-image-pe-mlxderives the repo iddgrauet/pe-mlx, notdgrauet/ernie-image-pe-mlx.derive_repo_idtakes the last path segment ofsource, which isbaidu/ERNIE-Image-Turbo/pe→pe. A real run would have created a junk repo. Not fixed here — it deserves its own change — but the pushes will pass--repo-idexplicitly.2.
--card-onlyrequired local weightsIt pushes only the README and the manifest, yet refused to run without local
.safetensors. That is why 20 of the 21 published cards could not be refreshed at all: the weights are long gone from disk.3.
--card-onlypublished sizes from the wrong buildThe file listing merged the local directory over the remote.
models/ernie-image-pe-mlxholds a 7.14 GBpe.safetensorswhile the repo has 6.39 GB — the card would have advertised a size the repo does not have. In card-only mode nothing local is uploaded, so the remote is now the whole truth.Result: all twelve lossless repos dry-run clean
ernie-image-pe-mlx,ernie-image-sft-mlx,ernie-image-turbo-mlxltx-2.3-mlx×3transformer-distilled-1.1.safetensorsand its LoRA, added by the delta workflow and never mentionedmatrix-game-3.0-mlxgoogle/umt5-xxl/*tokenizersZero losses anywhere.
Verification
747 tests pass;
ruffandtyclean. The listing-precedence fix is covered both ways: card-only takes the remote size, a full upload takes the local one.No card has been pushed.
🤖 Generated with Claude Code
https://claude.ai/code/session_01TaEHdLNyZuqjxqGmZ73JG9