-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use absolute paths in model manager #5900
Merged
Merged
Conversation
This file contains 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
eb337a2
to
177677f
Compare
maryhipp
approved these changes
Mar 8, 2024
2af1fa2
to
d498366
Compare
hipsterusername
approved these changes
Mar 8, 2024
d498366
to
3ead2f8
Compare
lstein
approved these changes
Mar 8, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine. The original idea of using relative paths was to make it easier to move the root directory around, but in fact the .venv
contained within the root can't be moved without breaking stuff, so it is moot.
… assume the model path is an absolute path
3ead2f8
to
ebaee02
Compare
psychedelicious
added a commit
that referenced
this pull request
Mar 29, 2024
We switched all model paths to be absolute in #5900. In hindsight, this is a mistake, because it makes the `models_dir` non-portable. This change reverts to the previous model pathing: - Invoke-managed models (in the `models_dir`) are stored with relative paths - Non-invoke-managed models (outside the `models_dir`, i.e. in-place installed models) still have absolute paths. ## Why absolute paths make things non-portable Let's say my `models_dir` is `/media/rhino/invokeai/models/`. In the DB, all model paths will be absolute children of this path, like this: - `/media/rhino/invokeai/models/sd-1/main/model1.ckpt` I want to change my `models_dir` to `/home/bat/invokeai/models/`. I update my `invokeai.yaml` file and physically move the files to that directory. On startup, the app checks for missing models. Because all of my model paths were absolute, they now point to a nonexistent path. All models are broken. There are a couple options to recover from this situation, neither of which are reasonable: 1. The user must manually update every model's path. Unacceptable UX. 2. On startup, we check for missing models. For each missing model, we compare its path with the last-known models dir. If there is a match, we replace that portion of the path with the new models dir. Then we re-check to see if the path exists. If it does, we update the models DB entry. Brittle and requires a new DB entry for last-known models dir. It's better to use relative paths for Invoke-managed models.
hipsterusername
pushed a commit
that referenced
this pull request
Mar 29, 2024
We switched all model paths to be absolute in #5900. In hindsight, this is a mistake, because it makes the `models_dir` non-portable. This change reverts to the previous model pathing: - Invoke-managed models (in the `models_dir`) are stored with relative paths - Non-invoke-managed models (outside the `models_dir`, i.e. in-place installed models) still have absolute paths. ## Why absolute paths make things non-portable Let's say my `models_dir` is `/media/rhino/invokeai/models/`. In the DB, all model paths will be absolute children of this path, like this: - `/media/rhino/invokeai/models/sd-1/main/model1.ckpt` I want to change my `models_dir` to `/home/bat/invokeai/models/`. I update my `invokeai.yaml` file and physically move the files to that directory. On startup, the app checks for missing models. Because all of my model paths were absolute, they now point to a nonexistent path. All models are broken. There are a couple options to recover from this situation, neither of which are reasonable: 1. The user must manually update every model's path. Unacceptable UX. 2. On startup, we check for missing models. For each missing model, we compare its path with the last-known models dir. If there is a match, we replace that portion of the path with the new models dir. Then we re-check to see if the path exists. If it does, we update the models DB entry. Brittle and requires a new DB entry for last-known models dir. It's better to use relative paths for Invoke-managed models.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backend
PRs that change backend files
python
PRs that change python files
python-tests
PRs that change python tests
services
PRs that change app services
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.
What type of PR is this? (check all applicable)
Have you discussed this change with the InvokeAI team?
Have you updated all relevant documentation?
Description
Removes relative paths for models within model manager. This should make it less likely that paths managed in the backend point to non-existant files/dirs. This also removes the logic that has to guess whether or not the path is relative or absolute.
Merge Plan
This PR can be merged when approved
Added/updated tests?
have not been included