mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
add compatibility reexport for codeformers
This commit is contained in:
@@ -9,6 +9,8 @@ Service release addressing all zero-day issues reported so far...
|
||||
- fix freeu for backend original and add it to xyz grid
|
||||
- fix loading diffuser models in huggingface format from non-standard location
|
||||
- fix default styles looking in wrong location
|
||||
- fix missing upscaler folder on initial startup
|
||||
- enhance extension compatibility for exensions directly importing codeformers
|
||||
- update `typing-extensions`
|
||||
|
||||
**Themes**
|
||||
|
||||
+2
-1
@@ -182,7 +182,8 @@ class Api:
|
||||
if shared.opts.motd:
|
||||
res = requests.get('https://vladmandic.github.io/automatic/motd', timeout=10)
|
||||
if res.status_code == 200:
|
||||
shared.log.info(f'MOTD: {res.text}')
|
||||
msg = (res.text or '').strip()
|
||||
shared.log.info(f'MOTD: {msg if len(msg) > 0 else "N/A"}')
|
||||
motd += res.text
|
||||
return motd
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
import cv2
|
||||
import torch
|
||||
|
||||
import modules.face_restoration
|
||||
from modules import shared, devices, modelloader, errors
|
||||
from modules.paths import models_path
|
||||
@@ -88,7 +85,7 @@ def setup_model(dirname):
|
||||
cropped_face_t = cropped_face_t.unsqueeze(0).to(devices.device_codeformer)
|
||||
try:
|
||||
with devices.inference_context():
|
||||
output = self.net(cropped_face_t, w=w if w is not None else shared.opts.code_former_weight, adain=True)[0]
|
||||
output = self.net(cropped_face_t, w=w if w is not None else shared.opts.code_former_weight, adain=True)[0] # pylint: disable=not-callable
|
||||
restored_face = tensor2img(output, rgb2bgr=True, min_max=(-1, 1))
|
||||
del output
|
||||
devices.torch_gc()
|
||||
|
||||
@@ -64,6 +64,8 @@ class Upscaler:
|
||||
scalers.append(scaler)
|
||||
loaded.append(model_path)
|
||||
# modules.shared.log.debug(f'Upscaler type={self.name} folder="{self.user_path}" model="{model[0]}" path="{model_path}"')
|
||||
if not os.path.exists(self.user_path):
|
||||
return scalers
|
||||
for fn in os.listdir(self.user_path): # from folder
|
||||
if not fn.endswith('.pth') and not fn.endswith('.pt'):
|
||||
continue
|
||||
|
||||
@@ -100,6 +100,7 @@ def initialize():
|
||||
|
||||
import modules.postprocess.codeformer_model as codeformer
|
||||
codeformer.setup_model(opts.codeformer_models_path)
|
||||
sys.modules["modules.codeformer_model"] = codeformer
|
||||
import modules.postprocess.gfpgan_model as gfpgan
|
||||
gfpgan.setup_model(opts.gfpgan_models_path)
|
||||
timer.startup.record("face-restore")
|
||||
|
||||
Reference in New Issue
Block a user