Skip to content

Commit 563da9e

Browse files
feat(mm): write warning README file to models dir
1 parent c8d9cdc commit 563da9e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

invokeai/app/services/model_install/model_install_default.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ def start(self, invoker: Optional[Invoker] = None) -> None:
135135
for model in self._scan_for_missing_models():
136136
self._logger.warning(f"Missing model file: {model.name} at {model.path}")
137137

138+
self._write_invoke_managed_models_dir_readme()
139+
138140
def stop(self, invoker: Optional[Invoker] = None) -> None:
139141
"""Stop the installer thread; after this the object can be deleted and garbage collected."""
140142
if not self._running:
@@ -147,6 +149,14 @@ def stop(self, invoker: Optional[Invoker] = None) -> None:
147149
self._install_thread.join()
148150
self._running = False
149151

152+
def _write_invoke_managed_models_dir_readme(self) -> None:
153+
"""Write a README file to the Invoke-managed models directory warning users to not fiddle with it."""
154+
readme_path = self.app_config.models_path / "README.txt"
155+
with open(readme_path, "wt", encoding=locale.getpreferredencoding()) as f:
156+
f.write(
157+
"This directory is managed by Invoke. Do not add, delete or move files in this directory.\n\nTo manage models, use the web interface.\n"
158+
)
159+
150160
def _clear_pending_jobs(self) -> None:
151161
for job in self.list_jobs():
152162
if not job.in_terminal_state:

0 commit comments

Comments
 (0)