InvokeAI/invokeai/backend/image_util
Lincoln Stein e93f4d632d
[util] Add generic torch device class (#6174)
* introduce new abstraction layer for GPU devices

* add unit test for device abstraction

* fix ruff

* convert TorchDeviceSelect into a stateless class

* move logic to select context-specific execution device into context API

* add mock hardware environments to pytest

* remove dangling mocker fixture

* fix unit test for running on non-CUDA systems

* remove unimplemented get_execution_device() call

* remove autocast precision

* Multiple changes:

1. Remove TorchDeviceSelect.get_execution_device(), as well as calls to
   context.models.get_execution_device().
2. Rename TorchDeviceSelect to TorchDevice
3. Added back the legacy public API defined in `invocation_api`, including
   choose_precision().
4. Added a config file migration script to accommodate removal of precision=autocast.

* add deprecation warnings to choose_torch_device() and choose_precision()

* fix test crash

* remove app_config argument from choose_torch_device() and choose_torch_dtype()

---------

Co-authored-by: Lincoln Stein <lstein@gmail.com>
2024-04-15 13:12:49 +00:00
..
basicsr feat(backend): remove dependency on basicsr 2024-02-11 08:34:54 +11:00
depth_anything [util] Add generic torch device class (#6174) 2024-04-15 13:12:49 +00:00
dw_openpose [util] Add generic torch device class (#6174) 2024-04-15 13:12:49 +00:00
infill_methods [util] Add generic torch device class (#6174) 2024-04-15 13:12:49 +00:00
realesrgan [util] Add generic torch device class (#6174) 2024-04-15 13:12:49 +00:00
__init__.py wip: Initial Infill Methods Refactor 2024-04-05 08:49:13 +11:00
canny.py tidy: "fit_image_to_resolution" -> "resize_image_to_resolution" 2024-03-21 07:02:57 -07:00
hed.py tidy: "fit_image_to_resolution" -> "resize_image_to_resolution" 2024-03-21 07:02:57 -07:00
invisible_watermark.py fix(config): fix invisible_watermark handling 2024-03-19 09:24:28 +11:00
lineart_anime.py tidy: "fit_image_to_resolution" -> "resize_image_to_resolution" 2024-03-21 07:02:57 -07:00
lineart.py tidy: "fit_image_to_resolution" -> "resize_image_to_resolution" 2024-03-21 07:02:57 -07:00
pngwriter.py chore: ruff 2024-03-01 10:42:33 +11:00
safety_checker.py [util] Add generic torch device class (#6174) 2024-04-15 13:12:49 +00:00
seamless.py chore: pyflake lint fixes 2023-08-29 05:16:23 +12:00
util.py tidy: "fit_image_to_resolution" -> "resize_image_to_resolution" 2024-03-21 07:02:57 -07:00