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:
Manuel Schmid
2024-06-30 13:32:21 +02:00
parent 0b2e23a97e
commit c0e556a7f6
+7 -8
View File
@@ -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 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()
model = None
@@ -18,6 +16,7 @@ def perform_upscale(img):
print(f'Upscaling image with shape {str(img.shape)} ...')
if model is None:
model_filename = downloading_upscale_model()
sd = torch.load(model_filename)
sdo = OrderedDict()
for k, v in sd.items():