3
3
4
4
from abc import ABC , abstractmethod
5
5
from pathlib import Path
6
- from typing import Any , Dict , List , Optional , Union
6
+ from typing import List , Optional , Union
7
7
8
8
from pydantic .networks import AnyHttpUrl
9
9
12
12
from invokeai .app .services .events .events_base import EventServiceBase
13
13
from invokeai .app .services .invoker import Invoker
14
14
from invokeai .app .services .model_install .model_install_common import ModelInstallJob , ModelSource
15
- from invokeai .app .services .model_records import ModelRecordServiceBase
15
+ from invokeai .app .services .model_records import ModelRecordChanges , ModelRecordServiceBase
16
16
from invokeai .backend .model_manager import AnyModelConfig
17
17
18
18
@@ -64,15 +64,15 @@ def event_bus(self) -> Optional["EventServiceBase"]:
64
64
def register_path (
65
65
self ,
66
66
model_path : Union [Path , str ],
67
- config : Optional [Dict [ str , Any ] ] = None ,
67
+ config : Optional [ModelRecordChanges ] = None ,
68
68
) -> str :
69
69
"""
70
70
Probe and register the model at model_path.
71
71
72
72
This keeps the model in its current location.
73
73
74
74
:param model_path: Filesystem Path to the model.
75
- :param config: Dict of attributes that will override autoassigned values.
75
+ :param config: ModelRecordChanges object that will override autoassigned model record values.
76
76
:returns id: The string ID of the registered model.
77
77
"""
78
78
@@ -92,7 +92,7 @@ def unconditionally_delete(self, key: str) -> None:
92
92
def install_path (
93
93
self ,
94
94
model_path : Union [Path , str ],
95
- config : Optional [Dict [ str , Any ] ] = None ,
95
+ config : Optional [ModelRecordChanges ] = None ,
96
96
) -> str :
97
97
"""
98
98
Probe, register and install the model in the models directory.
@@ -101,22 +101,22 @@ def install_path(
101
101
the models directory handled by InvokeAI.
102
102
103
103
:param model_path: Filesystem Path to the model.
104
- :param config: Dict of attributes that will override autoassigned values.
104
+ :param config: ModelRecordChanges object that will override autoassigned model record values.
105
105
:returns id: The string ID of the registered model.
106
106
"""
107
107
108
108
@abstractmethod
109
109
def heuristic_import (
110
110
self ,
111
111
source : str ,
112
- config : Optional [Dict [ str , Any ] ] = None ,
112
+ config : Optional [ModelRecordChanges ] = None ,
113
113
access_token : Optional [str ] = None ,
114
114
inplace : Optional [bool ] = False ,
115
115
) -> ModelInstallJob :
116
116
r"""Install the indicated model using heuristics to interpret user intentions.
117
117
118
118
:param source: String source
119
- :param config: Optional dict . Any fields in this dict
119
+ :param config: Optional ModelRecordChanges object . Any fields in this object
120
120
will override corresponding autoassigned probe fields in the
121
121
model's config record as described in `import_model()`.
122
122
:param access_token: Optional access token for remote sources.
@@ -147,7 +147,7 @@ def heuristic_import(
147
147
def import_model (
148
148
self ,
149
149
source : ModelSource ,
150
- config : Optional [Dict [ str , Any ] ] = None ,
150
+ config : Optional [ModelRecordChanges ] = None ,
151
151
) -> ModelInstallJob :
152
152
"""Install the indicated model.
153
153
0 commit comments