Commit Graph

1241 Commits

Author SHA1 Message Date
Lincoln Stein
4ffe672bc1 final tidying before marking PR as ready for review
- Replace AnyModelLoader with ModelLoaderRegistry
- Fix type check errors in multiple files
- Remove apparently unneeded `get_model_config_enum()` method from model manager
- Remove last vestiges of old model manager
- Updated tests and documentation

resolve conflict with seamless.py
2024-02-17 23:04:03 -05:00
Lincoln Stein
ed2d9ae0d9 Tidy names and locations of modules
- Rename old "model_management" directory to "model_management_OLD" in order to catch
  dangling references to original model manager.
- Caught and fixed most dangling references (still checking)
- Rename lora, textual_inversion and model_patcher modules
- Introduce a RawModel base class to simplfy the Union returned by the
  model loaders.
- Tidy up the model manager 2-related tests. Add useful fixtures, and
  a finalizer to the queue and installer fixtures that will stop the
  services and release threads.
2024-02-17 11:56:28 -05:00
Lincoln Stein
09e7d35b55 Fix issues identified during PR review by RyanjDick and brandonrising
- ModelMetadataStoreService is now injected into ModelRecordStoreService
  (these two services are really joined at the hip, and should someday be merged)
- ModelRecordStoreService is now injected into ModelManagerService
- Reduced timeout value for the various installer and download wait*() methods
- Introduced a Mock modelmanager for testing
- Removed bare print() statement with _logger in the install helper backend.
- Removed unused code from model loader init file
- Made `locker` a private variable in the `LoadedModel` object.
- Fixed up model merge frontend (will be deprecated anyway!)
2024-02-15 23:25:56 -05:00
Brandon Rising
9758082dc5 Raise InvalidModelConfigException when unable to detect load class in ModelLoader 2024-02-14 13:16:15 -05:00
Brandon Rising
5f4ce0b118 Update _get_hf_load_class to support clipvision models 2024-02-14 13:07:45 -05:00
Lincoln Stein
8ac4b9b32c Merge branch 'refactor/model-manager2/loader' of github.com:invoke-ai/InvokeAI into refactor/model-manager2/loader 2024-02-14 11:11:00 -05:00
Lincoln Stein
ec77599e79 improve swagger documentation 2024-02-14 11:10:50 -05:00
Brandon Rising
d4525e1282 References to context.services.model_manager.store.get_model can only accept keys, remove invalid assertion 2024-02-14 09:51:11 -05:00
Brandon Rising
b0d67ea2cc Remove references to model_records service, change submodel property on ModelInfo to submodel_type to support new params in model manager 2024-02-14 09:36:30 -05:00
Lincoln Stein
bd802d1e7a fix a number of typechecking errors 2024-02-13 00:26:49 -05:00
Lincoln Stein
433eb73d8e add route for model conversion from safetensors to diffusers
- Begin to add SwaggerUI documentation for AnyModelConfig and other
  discriminated Unions.
2024-02-12 23:31:52 -05:00
Lincoln Stein
b71f53ba86 add a JIT download_and_cache() call to the model installer 2024-02-12 14:27:17 -05:00
Lincoln Stein
68064c133a add back the heuristic_import() method and extend repo_ids to arbitrary file paths 2024-02-11 23:37:49 -05:00
Lincoln Stein
411ec1ed64
Merge branch 'main' into refactor/model-manager2/loader 2024-02-10 18:52:37 -05:00
Lincoln Stein
40a81c358d make model manager v2 ready for PR review
- Replace legacy model manager service with the v2 manager.

- Update invocations to use new load interface.

- Fixed many but not all type checking errors in the invocations. Most
  were unrelated to model manager

- Updated routes. All the new routes live under the route tag
  `model_manager_v2`. To avoid confusion with the old routes,
  they have the URL prefix `/api/v2/models`. The old routes
  have been de-registered.

- Added a pytest for the loader.

- Updated documentation in contributing/MODEL_MANAGER.md
2024-02-10 18:17:56 -05:00
psychedelicious
c5f069a255 feat(backend): remove dependency on basicsr
`basicsr` has a hard dependency on torchvision <= 0.16 and is unmaintained. Extract the code we need from it and remove the dep.

Closes #5108
2024-02-11 08:34:54 +11:00
Lincoln Stein
1d724bca4a consolidate model manager parts into a single class 2024-02-09 23:09:26 -05:00
Lincoln Stein
a6508d1391 probe for required encoder for IPAdapters and add to config 2024-02-09 20:46:47 -05:00
Lincoln Stein
1eeca48529 fix invokeai_configure script to work with new mm; rename CLIs 2024-02-09 16:42:33 -05:00
Lincoln Stein
79d028ecbd BREAKING CHANGES: invocations now require model key, not base/type/name
- Implement new model loader and modify invocations and embeddings

- Finish implementation loaders for all models currently supported by
  InvokeAI.

- Move lora, textual_inversion, and model patching support into
  backend/embeddings.

- Restore support for model cache statistics collection (a little ugly,
  needs work).

- Fixed up invocations that load and patch models.

- Move seamless and silencewarnings utils into better location
2024-02-08 23:26:41 -05:00
Lincoln Stein
531d2c8fd7 Multiple refinements on loaders:
- Cache stat collection enabled.
- Implemented ONNX loading.
- Add ability to specify the repo version variant in installer CLI.
- If caller asks for a repo version that doesn't exist, will fall back
  to empty version rather than raising an error.
2024-02-05 21:55:11 -05:00
Lincoln Stein
37675ee4f5 added textual inversion and lora loaders 2024-02-04 23:18:00 -05:00
Lincoln Stein
26f721d0ec Merge branch 'main' into refactor/model-manager2/loader 2024-02-04 20:26:18 -05:00
Lincoln Stein
420f6050a6 loaders for main, controlnet, ip-adapter, clipvision and t2i 2024-02-04 17:23:10 -05:00
Lincoln Stein
8e500283b6
Fix broken import in checkpoint_convert (#5635)
* Fix broken import in checkpoint_convert

* simplify the fix

---------

Co-authored-by: Lincoln Stein <lstein@gmail.com>
2024-02-04 12:56:51 +00:00
Lincoln Stein
9804cb0e67 model loading and conversion implemented for vaes 2024-02-03 22:55:09 -05:00
Lincoln Stein
4c5aedbcba merge with main 2024-02-02 12:35:24 -05:00
Lincoln Stein
f2777f5096
Port the command-line tools to use model_manager2 (#5546)
* Port the command-line tools to use model_manager2

1.Reimplement the following:

  - invokeai-model-install
  - invokeai-merge
  - invokeai-ti

  To avoid breaking the original modeal manager, the udpated tools
  have been renamed invokeai-model-install2 and invokeai-merge2. The
  textual inversion training script should continue to work with
  existing installations. The "starter" models now live in
  `invokeai/configs/INITIAL_MODELS2.yaml`.

  When the full model manager 2 is in place and working, I'll rename
  these files and commands.

2. Add the `merge` route to the web API. This will merge two or three models,
   resulting a new one.

   - Note that because the model installer selectively installs the `fp16` variant
     of models (rather than both 16- and 32-bit versions as previous),
     the diffusers merge script will choke on any huggingface diffuserse models
     that were downloaded with the new installer. Previously-downloaded models
     should continue to merge correctly. I have a PR
     upstream https://github.com/huggingface/diffusers/pull/6670 to fix
     this.

3. (more important!)
  During implementation of the CLI tools, found and fixed a number of small
  runtime bugs in the model_manager2 implementation:

  - During model database migration, if a registered models file was
    not found on disk, the migration would be aborted. Now the
    offending model is skipped with a log warning.

  - Caught and fixed a condition in which the installer would download the
    entire diffusers repo when the user provided a single `.safetensors`
    file URL.

  - Caught and fixed a condition in which the installer would raise an
    exception and stop the app when a request for an unknown model's metadata
    was passed to Civitai. Now an error is logged and the installer continues.

  - Replaced the LoWRA starter LoRA with FlatColor. The former has been removed
    from Civitai.

* fix ruff issue

---------

Co-authored-by: Lincoln Stein <lstein@gmail.com>
2024-02-02 17:18:47 +00:00
Brandon
72db2ee352
Merge branch 'main' into sdxl-convert-safetensors 2024-02-02 10:10:49 -05:00
Wubbbi
1057314508 Fix ruff? 2024-02-01 20:40:28 -05:00
Wubbbi
73a077956b Why did my IDE change the comment? 2024-02-01 20:40:28 -05:00
Wubbbi
5e1e50bd47 Fix hopefully last import 2024-02-01 20:40:28 -05:00
Wubbbi
413fe566b8 Fix imports 2024-02-01 20:40:28 -05:00
Wubbbi
c9b5f06c42 Update diffusers + hotfix 2024-02-01 20:40:28 -05:00
Lincoln Stein
a380d1f3b2 add ram cache module and support files 2024-01-31 23:37:59 -05:00
Brandon
06bcc07f65
Merge branch 'main' into sdxl-convert-safetensors 2024-01-31 17:00:19 -05:00
Brandon Rising
a0996b1c0a Fix ruff styling 2024-01-31 07:16:14 -06:00
Brandon Rising
522ff4a042 civit -> civitai 2024-01-31 07:16:14 -06:00
Brandon Rising
a769f93be0 Remove unnecessary change 2024-01-31 07:16:14 -06:00
Brandon Rising
5d773dc94c Remove debug line 2024-01-31 07:16:14 -06:00
Brandon Rising
088e3420e6 Allow passing of civit api key via config 2024-01-31 07:16:14 -06:00
Brandon Rising
14efc95707 Allow passing of a civit api key 2024-01-31 07:16:14 -06:00
Brandon Rising
a04981b418 This seems to work now 2024-01-30 21:32:08 -05:00
blessedcoolant
35184dbd86 fix: incorrect local file path 2024-01-24 03:37:16 +05:30
blessedcoolant
92fb09c4df fix: Move the models to any folder to avoid boot warnings 2024-01-24 03:35:37 +05:30
blessedcoolant
7cb49e65bd feat: Add Resolution to DepthAnything 2024-01-23 14:13:50 -06:00
blessedcoolant
6a2eb1d2e4 fix: Change the path of the annotator folder to annotators
Just making this change in case there are other models added to the folder in the future
2024-01-23 14:13:50 -06:00
blessedcoolant
c859eb865e fix: lint & other minor issues 2024-01-23 14:13:50 -06:00
blessedcoolant
8f5e2cbcc7 feat: Add Depth Anything PreProcessor 2024-01-23 14:13:50 -06:00
Lincoln Stein
6b8a6e12bc add concept of repo variant 2024-01-22 14:37:23 -05:00