InvokeAI/invokeai/backend/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
..
__init__.py [util] Add generic torch device class (#6174) 2024-04-15 13:12:49 +00:00
attention.py chore: ruff 2024-03-01 10:42:33 +11:00
db_maintenance.py Use defaults for db_dir and outdir since config no longer writes defaults to invokeai.yaml 2024-03-28 22:39:48 -04:00
devices.py [util] Add generic torch device class (#6174) 2024-04-15 13:12:49 +00:00
hotfixes.py Fix ruff? 2024-02-01 20:40:28 -05:00
logging.py partially address --root CLI argument handling 2024-03-19 09:24:28 +11:00
mask.py Add utility to_standard_float_mask(...) to convert various mask formats to a standardized format. 2024-04-09 08:12:12 -04:00
mps_fixes.py add note about discriminated union and Body() issue; blackified 2023-11-12 16:50:05 -05:00
silence_warnings.py chore: ruff 2024-03-01 10:42:33 +11:00
test_utils.py tidy(mm): remove convenience methods from high level model manager service 2024-03-07 10:56:59 +11:00
util.py cleanup: remove unused scripts, cruft 2024-03-20 15:05:25 +11:00