mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
fix styles
This commit is contained in:
+2
-2
@@ -89,8 +89,8 @@ def test_fp16():
|
||||
_y = layerNorm(x)
|
||||
shared.log.debug('Torch FP16 test passed')
|
||||
return True
|
||||
except Exception:
|
||||
shared.log.warning('Torch FP16 test failed: Forcing FP32 operations')
|
||||
except Exception as e:
|
||||
shared.log.warning(f'Torch FP16 test failed: Forcing FP32 operations: {e}')
|
||||
shared.opts.cuda_dtype = 'FP32'
|
||||
shared.opts.no_half = True
|
||||
shared.opts.no_half_vae = True
|
||||
|
||||
+5
-2
@@ -3,6 +3,8 @@ from __future__ import annotations
|
||||
import csv
|
||||
import os
|
||||
import os.path
|
||||
import tempfile
|
||||
import shutil
|
||||
import typing
|
||||
from installer import log
|
||||
|
||||
@@ -53,7 +55,6 @@ class StyleDatabase:
|
||||
self.styles[row["name"]] = PromptStyle(row["name"], prompt, negative_prompt)
|
||||
except Exception:
|
||||
log.error(f'Styles error: {self.path} {row}')
|
||||
pass
|
||||
log.debug(f'Loaded styles: {self.path} {len(self.styles.keys())}')
|
||||
|
||||
def get_style_prompts(self, styles):
|
||||
@@ -72,8 +73,10 @@ class StyleDatabase:
|
||||
basedir = os.path.dirname(path)
|
||||
if basedir is not None and len(basedir) > 0:
|
||||
os.makedirs(basedir, exist_ok=True)
|
||||
with os.fdopen(path, "w", encoding="utf-8-sig", newline='') as file:
|
||||
fd, temp_path = tempfile.mkstemp(".csv")
|
||||
with os.fdopen(fd, "w", encoding="utf-8-sig", newline='') as file:
|
||||
writer = csv.DictWriter(file, fieldnames=PromptStyle._fields)
|
||||
writer.writeheader()
|
||||
writer.writerows(style._asdict() for k, style in self.styles.items())
|
||||
log.debug(f'Saved styles: {path} {len(self.styles.keys())}')
|
||||
shutil.move(temp_path, path)
|
||||
|
||||
Reference in New Issue
Block a user