mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
fix: get upscale model filepath by calling downloading_upscale_model()
ensures the model exists, called in https://github.com/mashb1t/Fooocus/blob/80068a0cd729d6148ac533bf844e1247a0baa9b4/modules/inpaint_worker.py#L162 see https://github.com/mashb1t/Fooocus/discussions/42#discussioncomment-9898976
This commit is contained in:
+7
-8
@@ -1,13 +1,11 @@
|
|||||||
import os
|
|
||||||
import torch
|
|
||||||
import modules.core as core
|
|
||||||
|
|
||||||
from ldm_patched.pfn.architecture.RRDB import RRDBNet as ESRGAN
|
|
||||||
from ldm_patched.contrib.external_upscale_model import ImageUpscaleWithModel
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from modules.config import path_upscale_models
|
|
||||||
|
|
||||||
model_filename = os.path.join(path_upscale_models, 'fooocus_upscaler_s409985e5.bin')
|
import modules.core as core
|
||||||
|
import torch
|
||||||
|
from ldm_patched.contrib.external_upscale_model import ImageUpscaleWithModel
|
||||||
|
from ldm_patched.pfn.architecture.RRDB import RRDBNet as ESRGAN
|
||||||
|
from modules.config import downloading_upscale_model
|
||||||
|
|
||||||
opImageUpscaleWithModel = ImageUpscaleWithModel()
|
opImageUpscaleWithModel = ImageUpscaleWithModel()
|
||||||
model = None
|
model = None
|
||||||
|
|
||||||
@@ -18,6 +16,7 @@ def perform_upscale(img):
|
|||||||
print(f'Upscaling image with shape {str(img.shape)} ...')
|
print(f'Upscaling image with shape {str(img.shape)} ...')
|
||||||
|
|
||||||
if model is None:
|
if model is None:
|
||||||
|
model_filename = downloading_upscale_model()
|
||||||
sd = torch.load(model_filename)
|
sd = torch.load(model_filename)
|
||||||
sdo = OrderedDict()
|
sdo = OrderedDict()
|
||||||
for k, v in sd.items():
|
for k, v in sd.items():
|
||||||
|
|||||||
Reference in New Issue
Block a user