Repository navigation
Conversation
Lightning's LightningCLI._parse_ckpt_path silently skips a missing
ckpt_path, so `viscy predict --ckpt_path=<missing>` only failed after the
trainer, model and datamodule were built. VisCyCLI now checks the
subcommand-level ckpt_path and model.init_args.ckpt_path right after
parsing and raises FileNotFoundError. Lightning keywords ("best", "last",
"hpc", "registry...") are passed through unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Merged
3 tasks done
Contributor
Author
|
@edyoshikun @alxndrkalinin let me know what you think about this, I think it's nice to have but optional |
This branch has not been deployed
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.
Summary
Lightning's
LightningCLI._parse_ckpt_pathsilently skips ackpt_paththat doesn't exist (if ckpt_path and Path(ckpt_path).is_file()). As a result,viscy predict --ckpt_path=<missing>builds the trainer, model and datamodule first, and only then fails withCheckpoint file not found.VisCyCLI._parse_ckpt_pathnow calls a new_check_ckpt_paths_existhelper right after parsing. It raisesFileNotFoundErrorwhen either of these is set but isn't an existing file:ckpt_path(e.g.viscy predict --ckpt_path)model.init_args.ckpt_path(e.g.VSUNet(ckpt_path=...))Lightning's keyword values (
best,last,hpc,registry...) skip the check. The check runs for every subcommand, sofit,validateandtestalso fail early on a missing checkpoint.Before / after
Tests
_check_ckpt_paths_exist: existing files, unset paths, Lightning keywords, missing trainer-level ckpt, missing model ckpt.viscy predictsubprocess test with BoringModel/BoringDataModule, which asserts the new error message.packages/viscy-utils/tests/test_cli.py: 21 passed. prek is clean.🤖 Generated with Claude Code