torch dynamic profiling

This commit is contained in:
Vladimir Mandic
2024-05-16 18:40:18 -04:00
parent d63f35e298
commit 554e5c8224
19 changed files with 45 additions and 29 deletions
+1 -1
View File
@@ -153,7 +153,7 @@ class APIControl():
# run
with self.queue_lock:
shared.state.begin('api-control', api=True)
shared.state.begin('API-CTL', api=True)
output_images = []
output_processed = []
output_info = ''
+2 -2
View File
@@ -104,7 +104,7 @@ class APIGenerate():
p.scripts = script_runner
p.outpath_grids = shared.opts.outdir_grids or shared.opts.outdir_txt2img_grids
p.outpath_samples = shared.opts.outdir_samples or shared.opts.outdir_txt2img_samples
shared.state.begin('api-txt2img', api=True)
shared.state.begin('API TXT', api=True)
script_args = script.init_script_args(p, txt2imgreq, self.default_script_arg_txt2img, selectable_scripts, selectable_script_idx, script_runner)
if selectable_scripts is not None:
processed = scripts.scripts_txt2img.run(p, *script_args) # Need to pass args as list here
@@ -148,7 +148,7 @@ class APIGenerate():
p.scripts = script_runner
p.outpath_grids = shared.opts.outdir_img2img_grids
p.outpath_samples = shared.opts.outdir_img2img_samples
shared.state.begin('api-img2img', api=True)
shared.state.begin('API-IMG', api=True)
script_args = script.init_script_args(p, img2imgreq, self.default_script_arg_img2img, selectable_scripts, selectable_script_idx, script_runner)
if selectable_scripts is not None:
processed = scripts.scripts_img2img.run(p, *script_args) # Need to pass args as list here
+2 -2
View File
@@ -64,7 +64,7 @@ class APIProcess():
for k, v in req.params.items():
if k not in processors.config[processor.processor_id]['params']:
return JSONResponse(status_code=400, content={"error": f"Processor invalid parameter: id={req.model} {k}={v}"})
shared.state.begin('api-preprocess', api=True)
shared.state.begin('API-PRE', api=True)
processed = processor(image, local_config=req.params)
image = encode_pil_to_base64(processed)
shared.state.end(api=False)
@@ -90,7 +90,7 @@ class APIProcess():
return JSONResponse(status_code=400, content={"error": f"Mask invalid parameter: {k}={v}"})
else:
setattr(masking.opts, k, v)
shared.state.begin('api-mask', api=True)
shared.state.begin('API-MASK', api=True)
with self.queue_lock:
processed = masking.run_mask(input_image=image, input_mask=mask, return_type=req.type)
shared.state.end(api=False)