Pass `prompt` argument to nodes that define it in their inputs
Hello! Thank you for the useful script.
I noticed that, when converting workflows containing efficiency nodes, the obtained script fails, unlike the original workflow on ComfyUI. The reason seems to be caused by the fact that these nodes take as input a prompt parameter in their API (ref), which in Comfy seems to be a special type of parameter containing the entire JSON workflow as a python dictionary. The efficiency nodes then use such information to perform optimizations and prune unused tensors.
When not passing prompt to these nodes, the default value None always causes a crash down the line. While it might be argued that the behavior is not a problem of this extension, it's also true that not passing prompt to nodes that accept it might lead to undesirable behavior. In this case, even when handling the lack of prompt gracefully, the efficiency nodes would probably not be able to carry out performance optimizations.
It would be great to update this extension to send prompt as input to the nodes that support it in the generated code.
I would need the workflow .json you are generating and the .py file created by the extension to better understand the issue. I've made some updates in the last couple of days to make the extension more flexible at accepting additional arguments from nodes, which may already address this issue.
I had the same problem, which still occurs even with the latest version of the code. the error occur when I use the custom node below, because the node can't get the 'prompt' input.
class humanSegmentation:
@classmethod
def INPUT_TYPES(cls):
return {
"required":{
"image": ("IMAGE",),
"method": (["selfie_multiclass_256x256", "human_parsing_lip", "human_parts (deeplabv3p)"],),
"confidence": ("FLOAT", {"default": 0.4, "min": 0.05, "max": 0.95, "step": 0.01},),
"crop_multi": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 10.0, "step": 0.001},),
},
"hidden": {
"prompt": "PROMPT",
"my_unique_id": "UNIQUE_ID",
}
}
.......
def parsing(self, image, confidence, method, crop_multi, prompt=None, my_unique_id=None):
mask_components = []
if my_unique_id in prompt: #!!! here error!!! : argument of type 'NoneType' is not iterable, it may means 'prompt' is None
if prompt[my_unique_id]["inputs"]['mask_components']:
mask_components = prompt[my_unique_id]["inputs"]['mask_components'].split(',')
......
Thank you for your attention to this issue. It would be of great help if it could be fixed.