fix install of models with relative paths

This commit is contained in:
Lincoln Stein
2023-09-22 11:49:18 -04:00
parent c9cd418ed8
commit 07ddd601e1
2 changed files with 6 additions and 1 deletions

View File

@ -388,6 +388,11 @@ class ModelInstall(ModelInstallBase):
def _register(self, model_path: Path, info: ModelProbeInfo) -> str:
key: str = FastModelHash.hash(model_path)
model_path = model_path.absolute()
if model_path.is_relative_to(self._app_config.models_path):
model_path = model_path.relative_to(self._app_config.models_path)
registration_data = dict(
path=model_path.as_posix(),
name=model_path.name if model_path.is_dir() else model_path.stem,

View File

@ -537,7 +537,7 @@ def list_models(installer: ModelInstall, model_type: ModelType):
print(f"Installed models of type `{model_type}`:")
for model in models:
path = (config.models_path / model.path).resolve()
print(f"{model.name:40}{model.base_model:10}{path}")
print(f"{model.name:40}{model.base_model.value:14}{path}")
class TqdmProgress(object):