Skip to content
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

feat(mm): restore relative paths for invoke-managed models #6087

Merged
merged 8 commits into from
Mar 29, 2024

Commits on Mar 29, 2024

  1. feat(mm): use relative paths for invoke-managed models

    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.
    psychedelicious committed Mar 29, 2024
    Configuration menu
    Copy the full SHA
    26472f9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9aacd86 View commit details
    Browse the repository at this point in the history
  3. fix(mm): handle relative conversion config paths

    I have tested main, controlnet and vae checkpoint conversions.
    psychedelicious committed Mar 29, 2024
    Configuration menu
    Copy the full SHA
    62b1ada View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    bd6f26c View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    18daed4 View commit details
    Browse the repository at this point in the history
  6. feat(mm): update v3 models.yaml migration logic to handle relative pa…

    …ths for legacy config files
    psychedelicious committed Mar 29, 2024
    Configuration menu
    Copy the full SHA
    3609e27 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    ece1b6d View commit details
    Browse the repository at this point in the history
  8. use is_relative_to() rather than relying on string matching to determ…

    …ine relative directory positioning
    Lincoln Stein committed Mar 29, 2024
    Configuration menu
    Copy the full SHA
    76cecb2 View commit details
    Browse the repository at this point in the history