feat(model_manager): Add scan and delete of orphaned models#8826
Open
lstein wants to merge 5 commits intoinvoke-ai:mainfrom
Open
feat(model_manager): Add scan and delete of orphaned models#8826lstein wants to merge 5 commits intoinvoke-ai:mainfrom
lstein wants to merge 5 commits intoinvoke-ai:mainfrom
Conversation
- This commit adds command-line and Web GUI functionality for identifying and optionally removing models in the models directory that are not referenced in the database. Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
Co-authored-by: lstein <111189+lstein@users.noreply.github.com> Add expandable file list to orphaned models dialog Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
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
This PR addresses the situation in which there are "orphaned" models in the
INVOKEAI_ROOT/modelsdirectory that are not registered in the database. The PR offers two ways of dealing with them:scripts/remove_orphaned_models.pythat lists the orphans and prompts the user to delete the orphan model directories.This functionality complements the recently-added PR #8801 , which implemented a filter to show models in the database that are missing or incomplete, and offers to remove them from the database.
Related Issues / Discussions
None
QA Instructions
Because this functionality has the potential to delete models on disk, you might want to set up a testing invoke root.
Testing the command-line script:
Note that this is intended to be a developer-facing utility and is not particularly polished.
python3 scripts/remove_orphaned_models.py --root /path/to/INVOKEAI_ROOTcd INVOKEAI_ROOT/models
mkdir -p orphan1 orphan2/encoder orphan3
touch orphan1/test.safetensors orphan2/encoder/test.bin orphan3/pytorch.safetensors
Testing the UI:
Merge Plan
Simple merge.
Checklist
What's Newcopy (if doing a release after this PR)