asagi4 / comfyui-prompt-control

ComfyUI nodes for prompt editing and LoRA control
GNU General Public License v3.0
207 stars 16 forks source link

[BUG] float() argument must be a string or a real number, not 'Tree' #53

Closed xxlukexx closed 4 months ago

xxlukexx commented 4 months ago

Before you start Verify the following:

  1. That your ComfyUI is up to date - YES
  2. That the extension is up to date - YES
  3. That the issue isn't in the "Known Issues" section in the README - YES

Describe the bug When attempting to schedule (whether using a lora of just part of the prompt) I get the following error. This was working fine until recently. I'm not sure if it changed when I updated comfyui or when I installed other custom nodes. However, it still occurs even when I disable all other custom nodes through the manager (other than the manager itself).

I think this is related to lark, here are the versions I have installed in my venv:

lark 1.1.9 lark-parser 0.12.0

I've tried debugging this and the first time tostep is called (when the value of i in CollectSteps.scheduled = -1), the value of s is : Token('NUMBER', '0.5') and it succeeds.

The second time tostep is called (when i = -2) the value of s is Tree('prompt', [Token('PLAIN', 'by akira toriyama')])


Error occurred when executing PromptToSchedule:

float() argument must be a string or a real number, not 'Tree'

File "E:\comfyui2\ComfyUI\execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\comfyui2\ComfyUI\execution.py", line 81, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\comfyui2\ComfyUI\execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(*slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\comfyui2\ComfyUI\custom_nodes\comfyui-prompt-control\prompt_control\node_other.py", line 152, in parse schedules = parse_prompt_schedules(text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\comfyui2\ComfyUI\custom_nodes\comfyui-prompt-control\prompt_control\parser.py", line 394, in parse_prompt_schedules return PromptSchedule(prompt) ^^^^^^^^^^^^^^^^^^^^^^ File "E:\comfyui2\ComfyUI\custom_nodes\comfyui-prompt-control\prompt_control\parser.py", line 277, in init self.interpolations, self.parsed_prompt = self._parse() ^^^^^^^^^^^^^ File "E:\comfyui2\ComfyUI\custom_nodes\comfyui-prompt-control\prompt_control\parser.py", line 292, in _parse interpolation_steps, steps = get_steps(tree) ^^^^^^^^^^^^^^^ File "E:\comfyui2\ComfyUI\custom_nodes\comfyui-prompt-control\prompt_control\parser.py", line 129, in get_steps CollectSteps().visit(tree) File "e:\comfyui2\ComfyUI\venv\Lib\site-packages\lark\visitors.py", line 316, in visit self._call_userfunc(subtree) File "e:\comfyui2\ComfyUI\venv\Lib\site-packages\lark\visitors.py", line 294, in _call_userfunc return getattr(self, tree.data, self.default)(tree) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\comfyui2\ComfyUI\custom_nodes\comfyui-prompt-control\prompt_control\parser.py", line 105, in scheduled tree.children[i] = tostep(tree.children[i]) ^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\comfyui2\ComfyUI\custom_nodes\comfyui-prompt-control\prompt_control\parser.py", line 94, in tostep w = float(s) 100 ^^^^^^^^

To Reproduce Load example.json from /workflows folder, attempt to generate

asagi4 commented 4 months ago

I think you may need to remove lark-parser from your virtualenv. It seems to be an old version of lark or something.

I don't know why there are two lark packages, but my virtualenv only has lark 1.1.9 and I can't reproduce this issue.

xxlukexx commented 4 months ago

I think you may need to remove lark-parser from your virtualenv. It seems to be an old version of lark or something.

I don't know why there are two lark packages, but my virtualenv only has lark 1.1.9 and I can't reproduce this issue.

Thanks, removing both and then doing pip install -r requirements.txt fixed this for me.

xxlukexx commented 4 months ago

-