mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
cleanup logging
This commit is contained in:
@@ -240,7 +240,8 @@ def parse_generation_parameters(x: str):
|
||||
res[k] = v
|
||||
except Exception:
|
||||
pass
|
||||
res["Full quality"] = res.get('VAE', None) != 'TAESD'
|
||||
if res.get('VAE', None) == 'TAESD':
|
||||
res["Full quality"] = False
|
||||
debug(f"Parse prompt: {res}")
|
||||
return res
|
||||
|
||||
|
||||
+3
-2
@@ -569,13 +569,14 @@ def atomically_save_image():
|
||||
fn = os.path.join(paths.data_path, shared.opts.save_log_fn)
|
||||
if not fn.endswith('.json'):
|
||||
fn += '.json'
|
||||
entries = shared.readfile(fn)
|
||||
entries = shared.readfile(fn, silent=True)
|
||||
idx = len(list(entries))
|
||||
if idx == 0:
|
||||
entries = []
|
||||
entry = { 'id': idx, 'filename': filename, 'time': datetime.datetime.now().isoformat(), 'info': exifinfo }
|
||||
entries.append(entry)
|
||||
shared.writefile(entries, fn, mode='w')
|
||||
shared.writefile(entries, fn, mode='w', silent=True)
|
||||
shared.log.debug(f'Saving: json="{fn}" records={len(entries)}')
|
||||
save_queue.task_done()
|
||||
|
||||
|
||||
|
||||
@@ -102,7 +102,6 @@ def download_civit_preview(model_path: str, preview_url: str):
|
||||
os.remove(preview_file)
|
||||
res += f' error={e}'
|
||||
shared.log.error(f'CivitAI download error: url={preview_url} file={preview_file} written={written} {e}')
|
||||
errors.display(e, 'CivitAI download error')
|
||||
shared.state.end()
|
||||
if img is None:
|
||||
return res
|
||||
@@ -236,8 +235,7 @@ def download_diffusers_model(hub_id: str, cache_dir: str = None, download_config
|
||||
shared.log.error(f"Diffusers download error: {hub_id} {err}")
|
||||
return None
|
||||
try:
|
||||
# TODO diffusers is this real error?
|
||||
model_info_dict = hf.model_info(hub_id).cardData if pipeline_dir is not None else None # pylint: disable=no-member
|
||||
model_info_dict = hf.model_info(hub_id).cardData if pipeline_dir is not None else None
|
||||
except Exception:
|
||||
model_info_dict = None
|
||||
if model_info_dict is not None and "prior" in model_info_dict: # some checkpoints need to be downloaded as "hidden" as they just serve as pre- or post-pipelines of other pipelines
|
||||
|
||||
@@ -210,7 +210,7 @@ class StableDiffusionProcessing:
|
||||
self.s_tmax = float('inf') # not representable as a standard ui option
|
||||
shared.opts.data['clip_skip'] = clip_skip
|
||||
self.task_args = {}
|
||||
# TODO a1111 compatibility items
|
||||
# a1111 compatibility items
|
||||
self.refiner_switch_at = 0
|
||||
self.hr_prompt = ''
|
||||
self.all_hr_prompts = []
|
||||
@@ -596,8 +596,6 @@ def create_infotext(p: StableDiffusionProcessing, all_prompts=None, all_seeds=No
|
||||
"Model": None if (not shared.opts.add_model_name_to_info) or (not shared.sd_model.sd_checkpoint_info.model_name) else shared.sd_model.sd_checkpoint_info.model_name.replace(',', '').replace(':', ''),
|
||||
"Model hash": getattr(p, 'sd_model_hash', None if (not shared.opts.add_model_hash_to_info) or (not shared.sd_model.sd_model_hash) else shared.sd_model.sd_model_hash),
|
||||
"VAE": (None if not shared.opts.add_model_name_to_info or modules.sd_vae.loaded_vae_file is None else os.path.splitext(os.path.basename(modules.sd_vae.loaded_vae_file))[0]) if p.full_quality else 'TAESD',
|
||||
"Variation seed": None if p.subseed_strength == 0 else all_subseeds[index],
|
||||
"Variation strength": None if p.subseed_strength == 0 else p.subseed_strength,
|
||||
"Seed resize from": None if p.seed_resize_from_w == 0 or p.seed_resize_from_h == 0 else f"{p.seed_resize_from_w}x{p.seed_resize_from_h}",
|
||||
"Clip skip": p.clip_skip if p.clip_skip > 1 else None,
|
||||
"Prompt2": p.refiner_prompt if len(p.refiner_prompt) > 0 else None,
|
||||
@@ -613,6 +611,9 @@ def create_infotext(p: StableDiffusionProcessing, all_prompts=None, all_seeds=No
|
||||
}
|
||||
if 'txt2img' in p.ops:
|
||||
pass
|
||||
if shared.backend == shared.Backend.ORIGINAL:
|
||||
args["Variation seed"] = None if p.subseed_strength == 0 else all_subseeds[index],
|
||||
args["Variation strength"] = None if p.subseed_strength == 0 else p.subseed_strength,
|
||||
if 'hires' in p.ops or 'upscale' in p.ops:
|
||||
args["Second pass"] = p.enable_hr
|
||||
args["Hires force"] = p.hr_force
|
||||
|
||||
Reference in New Issue
Block a user