mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Experiment with using absolute paths within model management
This commit is contained in:
parent
66f0ff5b13
commit
e52274ecac
@ -581,9 +581,7 @@ class ModelInstallService(ModelInstallServiceBase):
|
|||||||
|
|
||||||
info = info or ModelProbe.probe(model_path, config)
|
info = info or ModelProbe.probe(model_path, config)
|
||||||
|
|
||||||
model_path = model_path.absolute()
|
model_path = model_path.resolve()
|
||||||
if model_path.is_relative_to(self.app_config.models_path):
|
|
||||||
model_path = model_path.relative_to(self.app_config.models_path)
|
|
||||||
|
|
||||||
info.path = model_path.as_posix()
|
info.path = model_path.as_posix()
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class ModelLoaderRegistryBase(ABC):
|
|||||||
TModelLoader = TypeVar("TModelLoader", bound=ModelLoaderBase)
|
TModelLoader = TypeVar("TModelLoader", bound=ModelLoaderBase)
|
||||||
|
|
||||||
|
|
||||||
class ModelLoaderRegistry:
|
class ModelLoaderRegistry(ModelLoaderRegistryBase):
|
||||||
"""
|
"""
|
||||||
This class allows model loaders to register their type, base and format.
|
This class allows model loaders to register their type, base and format.
|
||||||
"""
|
"""
|
||||||
|
@ -129,6 +129,8 @@ class ModelProbe(object):
|
|||||||
if fields is None:
|
if fields is None:
|
||||||
fields = {}
|
fields = {}
|
||||||
|
|
||||||
|
model_path = model_path.resolve()
|
||||||
|
|
||||||
format_type = ModelFormat.Diffusers if model_path.is_dir() else ModelFormat.Checkpoint
|
format_type = ModelFormat.Diffusers if model_path.is_dir() else ModelFormat.Checkpoint
|
||||||
model_info = None
|
model_info = None
|
||||||
model_type = None
|
model_type = None
|
||||||
|
@ -137,8 +137,7 @@ class ModelSearch(ModelSearchBase):
|
|||||||
|
|
||||||
def search(self, directory: Union[Path, str]) -> Set[Path]:
|
def search(self, directory: Union[Path, str]) -> Set[Path]:
|
||||||
self._directory = Path(directory)
|
self._directory = Path(directory)
|
||||||
if not self._directory.is_absolute():
|
self._directory = self._directory.resolve()
|
||||||
self._directory = self.config.models_path / self._directory
|
|
||||||
self.stats = SearchStats() # zero out
|
self.stats = SearchStats() # zero out
|
||||||
self.search_started() # This will initialize _models_found to empty
|
self.search_started() # This will initialize _models_found to empty
|
||||||
self._walk_directory(self._directory)
|
self._walk_directory(self._directory)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user