Skip to content

Commit edac01d

Browse files
author
Lincoln Stein
committed
reverse stupid hack
1 parent d04c880 commit edac01d

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

invokeai/app/services/model_install/model_install_default.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
from invokeai.backend.model_manager.probe import ModelProbe
4444
from invokeai.backend.model_manager.search import ModelSearch
4545
from invokeai.backend.util import InvokeAILogger
46-
from invokeai.backend.util.devices import TorchDevice
4746

4847
from .model_install_base import (
4948
MODEL_SOURCE_TO_TYPE_MAP,
@@ -637,7 +636,7 @@ def _next_id(self) -> int:
637636

638637
def _guess_variant(self) -> Optional[ModelRepoVariant]:
639638
"""Guess the best HuggingFace variant type to download."""
640-
precision = TorchDevice.choose_torch_dtype()
639+
precision = torch.float16 if self._app_config.precision == "auto" else torch.dtype(self._app_config.precision)
641640
return ModelRepoVariant.FP16 if precision == torch.float16 else None
642641

643642
def _import_local_model(self, source: LocalModelSource, config: Optional[Dict[str, Any]]) -> ModelInstallJob:

invokeai/backend/util/devices.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,7 @@ def set_model_cache(cls, cache: "ModelCacheBase[AnyModel]"):
5959
def choose_torch_device(cls) -> torch.device:
6060
"""Return the torch.device to use for accelerated inference."""
6161
if cls._model_cache:
62-
try:
63-
return cls._model_cache.get_execution_device()
64-
except ValueError as e: # May happen if no gpu was reserved. Return a generic device.
65-
if str(e).startswith("No GPU has been reserved"):
66-
pass
67-
else:
68-
raise e
62+
return cls._model_cache.get_execution_device()
6963
app_config = get_config()
7064
if app_config.device != "auto":
7165
device = torch.device(app_config.device)

0 commit comments

Comments
 (0)