mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
change script/extension loading priorities
This commit is contained in:
@@ -11,7 +11,7 @@ If you are looking an amazing simple-to-use Stable Diffusion tool, I'd suggest [
|
||||
|
||||
<br>
|
||||
|
||||

|
||||

|
||||
|
||||
<br>
|
||||
|
||||
@@ -37,8 +37,6 @@ If you are looking an amazing simple-to-use Stable Diffusion tool, I'd suggest [
|
||||
- Majority of settings configurable via UI without the need for command line flags
|
||||
e.g, cross-optimization methods, system folders, etc.
|
||||
|
||||
### UI
|
||||
|
||||
### Optimizations
|
||||
|
||||
- Optimized for `Torch` 2.0
|
||||
@@ -65,10 +63,11 @@ Hand-picked list of extensions that are deeply integrated into core workflows:
|
||||
|
||||
### User Interface
|
||||
|
||||
- Includes support for **Gradio themes**
|
||||
*Settings* -> *User interface* -> *UI theme*
|
||||
- Includes updated **UI**: reskinned and reorganized
|
||||
Black and orange dark theme with fixed width options panels and larger previews
|
||||
- Includes support for **Gradio themes**
|
||||
*Settings* -> *User interface* -> *UI theme*
|
||||
Link to themes list & previews: <https://huggingface.co/spaces/gradio/theme-gallery>
|
||||
|
||||
### Removed
|
||||
|
||||
@@ -124,13 +123,15 @@ Full startup sequence is logged in `setup.log`, so if you encounter any issues,
|
||||
|
||||
The launcher can perform automatic update of main repository, requirements, extensions and submodules:
|
||||
|
||||
- Main repository:
|
||||
- **Main repository**:
|
||||
Update is *not* performed by default, enable with `--upgrade` flag
|
||||
- Requirements:
|
||||
Check is performed on each startup and missing requirements are auto-installed, can be skipped with `--skip-requirements` flag
|
||||
- Extensions and submodules:
|
||||
Update is performed on each startup and installer for each extension is started, can be skipped with `--skip-extensions` flag
|
||||
- If timestamp of last sucessful setup is newer than actual repository version or version of newest extension, launcher will run in *quick* mode
|
||||
- **Requirements**:
|
||||
Check is performed on each startup and missing requirements are auto-installed
|
||||
Can be skipped with `--skip-requirements` flag
|
||||
- **Extensions and submodules**:
|
||||
Update is performed on each startup and installer for each extension is started
|
||||
Can be skipped with `--skip-extensions` flag
|
||||
- **Quick mode**: Automatically enabled if timestamp of last sucessful setup is newer than actual repository version or version of newest extension
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
@@ -93,10 +93,18 @@ Tech that can be integrated as part of the core workflow...
|
||||
### Update
|
||||
|
||||
- reconnect ui to active session on browser restart
|
||||
this is one of most frequently asked for items, finally figured it out
|
||||
works for text and image generation, but not for process as there is no progress bar reported there to start with
|
||||
- force unload `xformers` when not used, improves compatibility with AMD/M1
|
||||
- add `styles.csv` to UI settings to allow customizing path
|
||||
- force unload `xformers` when not used
|
||||
improves compatibility with AMD/M1 platforms
|
||||
- add `styles.csv` to UI settings to allow customizing path
|
||||
- add `--skip-git` to cmd flags for power users that want
|
||||
to skip all git checks and operations and perform manual updates
|
||||
- add `--disable-queue` to cmd flags that disables Gradio queues (experimental)
|
||||
this forces it to use HTTP instead of WebSockets and can help on unreliable network connections
|
||||
- allow scripts & extensions to set loading priority, fixes `ScuNet`
|
||||
- set scripts & extensions loading priority and allow custom priorities
|
||||
fixes random extension issues:
|
||||
`ScuNet` upscaler dissapearing, `Additional Networks` not showing up on XYZ axis, etc.
|
||||
- improve html loading order
|
||||
- remove some `asserts` causing runtime errors and replace with user-friendly messages
|
||||
- update README.md
|
||||
|
||||
Submodule extensions-builtin/sd-extension-system-info updated: b0a4fd79b5...52cd26c766
Submodule extensions-builtin/sd-webui-controlnet updated: c98dca5014...7d28d00e29
@@ -53,9 +53,10 @@ def image_from_url_text(filedata):
|
||||
if type(filedata) == dict and filedata.get("is_file", False):
|
||||
filename = filedata["name"]
|
||||
is_in_right_dir = ui_tempdir.check_tmp_file(shared.demo, filename)
|
||||
assert is_in_right_dir, 'trying to open image file outside of allowed directories'
|
||||
|
||||
return Image.open(filename)
|
||||
if is_in_right_dir:
|
||||
return Image.open(filename)
|
||||
else:
|
||||
print(f'Attempted to open file outside of allowed directories: {filename}')
|
||||
|
||||
if type(filedata) == list:
|
||||
if len(filedata) == 0:
|
||||
|
||||
@@ -45,6 +45,8 @@ def run_postprocessing(extras_mode, image, image_folder, input_dir, output_dir,
|
||||
infotext = ''
|
||||
|
||||
for image, name in zip(image_data, image_names):
|
||||
if image is None:
|
||||
continue
|
||||
shared.state.textinfo = name
|
||||
|
||||
pp = scripts_postprocessing.PostprocessedImage(image.convert("RGB"))
|
||||
|
||||
+25
-11
@@ -187,23 +187,38 @@ ScriptClassData = namedtuple("ScriptClassData", ["script_class", "path", "basedi
|
||||
|
||||
|
||||
def list_scripts(scriptdirname, extension):
|
||||
scripts_list = []
|
||||
tmp_list = []
|
||||
|
||||
base = os.path.join(paths.script_path, scriptdirname)
|
||||
if os.path.exists(base):
|
||||
priority = '50'
|
||||
if os.path.isfile(os.path.join(base, "..", ".priority")):
|
||||
with open(os.path.join(base, "..", ".priority"), "r", encoding="utf-8") as f:
|
||||
priority = str(f.read().strip())
|
||||
for filename in sorted(os.listdir(base)):
|
||||
scripts_list.append(ScriptFile(paths.script_path, filename, os.path.join(base, filename), priority))
|
||||
tmp_list.append(ScriptFile(paths.script_path, filename, os.path.join(base, filename), '50'))
|
||||
|
||||
for ext in extensions.active():
|
||||
scripts_list += ext.list_files(scriptdirname, extension)
|
||||
tmp_list += ext.list_files(scriptdirname, extension)
|
||||
|
||||
scripts_list = [x for x in scripts_list if os.path.splitext(x.path)[1].lower() == extension and os.path.isfile(x.path)]
|
||||
scripts_list = []
|
||||
for script in tmp_list:
|
||||
if os.path.splitext(script.path)[1].lower() == extension and os.path.isfile(script.path):
|
||||
if script.basedir == paths.script_path:
|
||||
priority = '0'
|
||||
elif script.basedir.startswith(os.path.join(paths.script_path, 'scripts')):
|
||||
priority = '1'
|
||||
elif script.basedir.startswith(os.path.join(paths.script_path, 'extensions-builtin')):
|
||||
priority = '2'
|
||||
elif script.basedir.startswith(os.path.join(paths.script_path, 'extensions')):
|
||||
priority = '3'
|
||||
else:
|
||||
priority = '9'
|
||||
if os.path.isfile(os.path.join(base, "..", ".priority")):
|
||||
with open(os.path.join(base, "..", ".priority"), "r", encoding="utf-8") as f:
|
||||
priority = priority + str(f.read().strip())
|
||||
else:
|
||||
priority = priority + script.priority
|
||||
scripts_list.append(ScriptFile(script.basedir, script.filename, script.path, priority))
|
||||
|
||||
return scripts_list
|
||||
priority_sort = sorted(scripts_list, key=lambda item: item.priority + item.path.lower(), reverse=False)
|
||||
return priority_sort
|
||||
|
||||
|
||||
def list_files_with_name(filename):
|
||||
@@ -242,8 +257,7 @@ def load_scripts():
|
||||
elif issubclass(script_class, scripts_postprocessing.ScriptPostprocessing):
|
||||
postprocessing_scripts_data.append(ScriptClassData(script_class, scriptfile.path, scriptfile.basedir, module))
|
||||
|
||||
priority_sort = sorted(scripts_list, key=lambda item: item.priority + item.path.lower(), reverse=False)
|
||||
for scriptfile in priority_sort:
|
||||
for scriptfile in scripts_list:
|
||||
try:
|
||||
if scriptfile.basedir != paths.script_path:
|
||||
sys.path = [scriptfile.basedir] + sys.path
|
||||
|
||||
@@ -109,6 +109,8 @@ def install(package, friendly: str = None, ignore: bool = False):
|
||||
|
||||
# execute git command
|
||||
def git(arg: str, ignore: bool = False):
|
||||
if args.skip_git:
|
||||
return ''
|
||||
git_cmd = os.environ.get('GIT', "git")
|
||||
result = subprocess.run(f'"{git_cmd}" {arg}', check=False, shell=True, env=os.environ, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
txt = result.stdout.decode(encoding="utf8", errors="ignore")
|
||||
@@ -347,6 +349,8 @@ def check_extensions():
|
||||
newest = 0
|
||||
extension_dir = os.path.join(extensions_dir, ext)
|
||||
for f in os.listdir(extension_dir):
|
||||
if '.json' in f or '.csv' in f:
|
||||
continue
|
||||
ts = os.path.getmtime(os.path.join(extension_dir, f))
|
||||
newest = max(newest, ts)
|
||||
newest_all = max(newest_all, newest)
|
||||
@@ -397,6 +401,8 @@ def check_version():
|
||||
def check_timestamp():
|
||||
if not quick_allowed or not os.path.isfile('setup.log'):
|
||||
return False
|
||||
if args.skip_git:
|
||||
return True
|
||||
ok = True
|
||||
setup_time = -1
|
||||
with open('setup.log', 'r', encoding='utf8') as f:
|
||||
@@ -434,6 +440,7 @@ def parse_args():
|
||||
parser.add_argument('--noupdate', default = False, action='store_true', help = "Skip update of extensions and submodules, default: %(default)s")
|
||||
parser.add_argument('--skip-requirements', default = False, action='store_true', help = "Skips checking and installing requirements, default: %(default)s")
|
||||
parser.add_argument('--skip-extensions', default = False, action='store_true', help = "Skips running individual extension installers, default: %(default)s")
|
||||
parser.add_argument('--skip-git', default = False, action='store_true', help = "Skips running all GIT operations, default: %(default)s")
|
||||
global args # pylint: disable=global-statement
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -455,6 +462,8 @@ def run_setup():
|
||||
check_python()
|
||||
if args.reset:
|
||||
git_reset()
|
||||
if args.skip_git:
|
||||
log.info('Skipping GIT operations')
|
||||
if check_timestamp():
|
||||
log.info('No changes detected: quick launch active')
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user