Repository navigation
Read CELLSEG3D_WEIGHTS_DIR on weights load - #150
Merged
Merged
Conversation
…ardcoded PRETRAINED_WEIGHTS_DIR references
… setup for weights directory
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Removing PRETRAINED_WEIGHTS_DIR from config leaves the Colab training notebook importing a nonexistent export, causing an ImportError before training can start.
1 open issue
What changed in this PR
This follow-up to #149 makes CellSeg3D resolve the weights directory when needed, allowing CELLSEG3D_WEIGHTS_DIR to be set after import.
Changes:
- Resolve download destinations per call and default
WeightsInfo.pathat instantiation. - Update training, inference, and tests to use the downloader’s returned file path.
- Document PowerShell configuration and clarify that existing weights are not moved.
| File | Description |
|---|---|
napari_cellseg3d/utils.py |
Rename the package directory constant and clarify runtime resolution. |
napari_cellseg3d/dev_scripts/colab_training.py |
Resolve the directory dynamically for logging. |
napari_cellseg3d/config.py |
Set the default weights path at instantiation. |
napari_cellseg3d/code_models/workers_utils.py |
Resolve each download destination and return the weights path. |
napari_cellseg3d/code_models/worker_training.py |
Load pretrained weights from the returned path. |
napari_cellseg3d/code_models/worker_inference.py |
Use the returned path for inference weights. |
napari_cellseg3d/code_models/models/model_test.py |
Resolve the destination when saving test weights. |
napari_cellseg3d/_tests/test_weight_download.py |
Cover custom directories, existing files, and returned paths. |
napari_cellseg3d/_tests/test_models.py |
Check compatibility using returned weights paths. |
napari_cellseg3d/_tests/test_inference.py |
Use the returned ONNX download path. |
docs/source/guides/inference_module_guide.rst |
Add Windows instructions and explain existing-file behavior. |
Review effort: Balanced
…in weight handling
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.

Follow-up to #149 by @guiwitz
Main changes
WeightsInfo.pathdefaults to the folder resolved at instantiationPRETRAINED_WEIGHTS_DIRwas removed fromconfigandworkers_utils; replaced byutils.get_pretrained_weights_dir()or the path returned bydownload_weights.utils.PRETRAINED_URLS_DIRis renamedPACKAGE_PRETRAINED_DIR, as it's also the default weights folder.