Skip to content

Commit

Permalink
Run ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonrising authored and maryhipp committed Mar 8, 2024
1 parent 10e7c08 commit fe4a90f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions invokeai/app/services/model_install/model_install_default.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Model installation class."""

import os
import pathlib
import re
import threading
import time
Expand All @@ -10,9 +11,9 @@
from shutil import copyfile, copytree, move, rmtree
from tempfile import mkdtemp
from typing import Any, Dict, List, Optional, Set, Union
from omegaconf import DictConfig, OmegaConf

from huggingface_hub import HfFolder
from omegaconf import DictConfig, OmegaConf
from pydantic.networks import AnyHttpUrl
from requests import Session

Expand Down Expand Up @@ -297,7 +298,6 @@ def _migrate_yaml(self) -> None:
except OSError:
return
if len(db_models) == 0 and len(yaml.items()) != 0:

self._logger.info("No models in DB, yaml items need to be migrated")

for model_key, stanza in yaml.items():
Expand All @@ -308,20 +308,18 @@ def _migrate_yaml(self) -> None:
continue

_, _, model_name = str(model_key).split("/")
import pathlib
model_path = pathlib.Path(stanza["path"])
if not model_path.is_absolute():
model_path = (self._app_config.models_path / model_path)
model_path.resolve()
model_path = self._app_config.models_path / model_path
model_path = model_path.resolve()
description = stanza["description"]
model_info = {"name": model_name, "description":description }
model_info = {"name": model_name, "description": description}

try:
self.register_path(model_path=model_path, config=model_info)
except Exception as e:
self._logger.warning(f"Model at {model_path} could not be loaded into database: {e}")


def scan_directory(self, scan_dir: Path, install: bool = False) -> List[str]: # noqa D102
self._cached_model_paths = {Path(x.path).absolute() for x in self.record_store.all_models()}
callback = self._scan_install if install else self._scan_register
Expand Down

0 comments on commit fe4a90f

Please sign in to comment.