fix(backend) installed models being redownloaded (#5526)

* fix

* fix ruff errors

---------

Co-authored-by: Lincoln Stein <lstein@gmail.com>
This commit is contained in:
Neil Wang 2024-01-18 21:53:53 +00:00 committed by GitHub
parent 1ab0e86085
commit aa25ea62a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -283,11 +283,16 @@ class ModelInstall(object):
def _remove_installed(self, model_list: List[str]):
all_models = self.all_models()
models_to_remove = []
for path in model_list:
key = self.reverse_paths.get(path)
if key and all_models[key].installed:
logger.warning(f"{path} already installed. Skipping.")
model_list.remove(path)
models_to_remove.append(path)
for path in models_to_remove:
logger.warning(f"{path} already installed. Skipping")
model_list.remove(path)
def _add_required_models(self, model_list: List[str]):
additional_models = []