Improve model search warning messages.

This commit is contained in:
Ryan Dick 2023-09-11 16:45:09 -04:00
parent 163ece9aee
commit 7ee55489bb

View File

@ -5,8 +5,8 @@ Abstract base class for recursive directory search for models.
import os import os
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from typing import List, Set, types
from pathlib import Path from pathlib import Path
from typing import List, Set, types
import invokeai.backend.util.logging as logger import invokeai.backend.util.logging as logger
@ -79,7 +79,7 @@ class ModelSearch(ABC):
self._models_found += 1 self._models_found += 1
self._scanned_dirs.add(path) self._scanned_dirs.add(path)
except Exception as e: except Exception as e:
self.logger.warning(str(e)) self.logger.warning(f"Failed to process '{path}': {e}")
for f in files: for f in files:
path = Path(root) / f path = Path(root) / f
@ -90,7 +90,7 @@ class ModelSearch(ABC):
self.on_model_found(path) self.on_model_found(path)
self._models_found += 1 self._models_found += 1
except Exception as e: except Exception as e:
self.logger.warning(str(e)) self.logger.warning(f"Failed to process '{path}': {e}")
class FindModels(ModelSearch): class FindModels(ModelSearch):