reduce race condition

Signed-off-by: vladmandic <mandic00@live.com>
This commit is contained in:
vladmandic
2026-02-27 12:07:56 +01:00
parent afff46f2ac
commit 403e9c2241
3 changed files with 4 additions and 6 deletions
+2 -4
View File
@@ -1259,8 +1259,7 @@ def get_version(force=False):
cwd = os.getcwd()
try:
if os.path.exists('extensions-builtin/sdnext-modernui'):
os.chdir('extensions-builtin/sdnext-modernui')
res = subprocess.run('git rev-parse --abbrev-ref HEAD', capture_output=True, shell=True, check=True)
res = subprocess.run('git rev-parse --abbrev-ref HEAD', capture_output=True, shell=True, check=True, cwd='extensions-builtin/sdnext-modernui')
branch_ui = res.stdout.decode(encoding = 'utf8', errors='ignore') if len(res.stdout) > 0 else ''
branch_ui = 'dev' if 'dev' in branch_ui else 'main'
version['ui'] = branch_ui
@@ -1275,8 +1274,7 @@ def get_version(force=False):
if os.environ.get('SD_KANVAS_DISABLE', None) is not None:
version['kanvas'] = 'disabled'
elif os.path.exists('extensions-builtin/sdnext-kanvas'):
os.chdir('extensions-builtin/sdnext-kanvas')
res = subprocess.run('git rev-parse --abbrev-ref HEAD', capture_output=True, shell=True, check=True)
res = subprocess.run('git rev-parse --abbrev-ref HEAD', capture_output=True, shell=True, check=True, cwd='extensions-builtin/sdnext-kanvas')
branch_kanvas = res.stdout.decode(encoding = 'utf8', errors='ignore') if len(res.stdout) > 0 else ''
branch_kanvas = 'dev' if 'dev' in branch_kanvas else 'main'
version['kanvas'] = branch_kanvas
+1 -1
View File
@@ -232,7 +232,7 @@ def move_model(model, device=None, force=False):
try:
t0 = time.time()
try:
if model.device == torch.device('meta'):
if hasattr(model, 'device') and model.device == torch.device('meta'):
set_execution_device(model, device)
elif hasattr(model, 'to'):
model.to(device)
+1 -1
View File
@@ -84,7 +84,7 @@ def html_css(css: list[str]):
head += stylesheet(themecss)
log.debug(f'UI theme: css="{themecss}" base="{css}" user="{usercss}"')
else:
log.error(f'UI theme: css="{themecss}" not found')
log.error(f'UI theme: css="{themecss}" path="{os.getcwd()}" not found')
elif modules.shared.opts.theme_type == 'Modern':
theme_folder = next((e.path for e in modules.extensions.extensions if e.name == 'sdnext-modernui'), None)
themecss = os.path.join(theme_folder or '', 'themes', f'{modules.shared.opts.gradio_theme}.css')