support inpaint
parent
f25249c646
commit
34fe2c5078
|
|
@ -161,7 +161,14 @@ class Script(scripts.Script):
|
||||||
donor_worker = job.worker
|
donor_worker = job.worker
|
||||||
except KeyError:
|
except KeyError:
|
||||||
if job.batch_size > 0:
|
if job.batch_size > 0:
|
||||||
logger.warning(f"Worker '{job.worker.uuid}' had nothing")
|
logger.warning(f"Worker '{job.worker.uuid}' had no images")
|
||||||
|
continue
|
||||||
|
except TypeError as e:
|
||||||
|
if job.worker.response is None:
|
||||||
|
logger.error(f"worker '{job.worker.uuid}' had no response")
|
||||||
|
else:
|
||||||
|
logger.exception(e)
|
||||||
|
continue
|
||||||
|
|
||||||
injected_to_iteration = 0
|
injected_to_iteration = 0
|
||||||
images_per_iteration = Script.world.get_current_output_size()
|
images_per_iteration = Script.world.get_current_output_size()
|
||||||
|
|
@ -179,6 +186,10 @@ class Script(scripts.Script):
|
||||||
else:
|
else:
|
||||||
injected_to_iteration += 1
|
injected_to_iteration += 1
|
||||||
|
|
||||||
|
if donor_worker is None:
|
||||||
|
logger.critical("couldn't collect any responses, distributed will do nothing")
|
||||||
|
return
|
||||||
|
|
||||||
# generate and inject grid
|
# generate and inject grid
|
||||||
if opts.return_grid:
|
if opts.return_grid:
|
||||||
grid = processing.images.image_grid(processed.images, len(processed.images))
|
grid = processing.images.image_grid(processed.images, len(processed.images))
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import json
|
||||||
import base64
|
import base64
|
||||||
import queue
|
import queue
|
||||||
from modules.shared import state as master_state
|
from modules.shared import state as master_state
|
||||||
|
from modules.api.api import encode_pil_to_base64
|
||||||
|
|
||||||
|
|
||||||
class InvalidWorkerResponse(Exception):
|
class InvalidWorkerResponse(Exception):
|
||||||
|
|
@ -322,6 +323,14 @@ class Worker:
|
||||||
images.append(image)
|
images.append(image)
|
||||||
payload['init_images'] = images
|
payload['init_images'] = images
|
||||||
|
|
||||||
|
# if an image mask is present
|
||||||
|
image_mask = payload.get('image_mask', None)
|
||||||
|
if image_mask is not None:
|
||||||
|
image_b64 = encode_pil_to_base64(image_mask)
|
||||||
|
image_b64 = str(image_b64, 'utf-8')
|
||||||
|
payload['mask'] = image_b64
|
||||||
|
del payload['image_mask']
|
||||||
|
|
||||||
# see if there is anything else wrong with serializing to payload
|
# see if there is anything else wrong with serializing to payload
|
||||||
try:
|
try:
|
||||||
json.dumps(payload)
|
json.dumps(payload)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue