Comfy-Org / ComfyUI_frontend

Official front-end implementation of ComfyUI
https://www.comfy.org/
GNU General Public License v3.0
575 stars 99 forks source link

[Bug]: Inconsistent JSON format for node position ("pos") between frontend v1.2.30 and v1.2.40 #710

Closed martin-rizzo closed 2 months ago

martin-rizzo commented 2 months ago

Frontend Version

v1.2.40

Expected Behavior

I expected the workflow JSON files saved with ComfyUI frontend v1.2.40 to be compatible with those saved using previous versions, such as v1.2.30. This consistency would ensure backward compatibility and prevent any issues when loading workflows created in different versions.

Actual Behavior

With ComfyUI frontend v1.2.40, the JSON format for storing node positions ("pos") has changed from an array to a dictionary format. For example, in v1.2.30, the "pos" data was stored as an array:

"pos": [
  600,
  340
]

In contrast, v1.2.40 stores the "pos" data as a dictionary with additional elements:

"pos": {
  "0": 600,
  "1": 340,
  "2": 0,
  "3": 0,
  "4": 0,
  "5": 0,
  "6": 0,
  "7": 0,
  "8": 0,
  "9": 0
}

While saving and loading workflows within the same frontend version (v1.2.40) works fine, this change could lead to incompatibility issues between different versions. There is already a related bug report that may be linked to this issue: Issue #4743

Steps to Reproduce

  1. Save the same workflow using ComfyUI frontend v1.2.30 and another using v1.2.40.
  2. Compare the resulting JSON files from each version.
  3. Observe the differences in the "pos" data storage format between the two versions.

I've attached the two JSON files saved from each frontend version and a screenshot highlighting the differences between them. workflow-v1.2.30.json workflow-v1.2.40.json workflow-diff

Debug Logs

Total VRAM 9906 MB, total RAM 31809 MB
pytorch version: 2.4.0+cu124
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3080 : cudaMallocAsync
Using pytorch cross attention
[Prompt Server] web root: /home/aiman/AIMan/Repos/comfyui/web
/home/aiman/AIMan/VEnv/comfyui-venv/lib64/python3.10/site-packages/kornia/feature/lightglue.py:44: FutureWarning: `torch.cuda.amp.custom_fwd(args...)` is deprecated. Please use `torch.amp.custom_fwd(args..., device_type='cuda')` instead.
  @torch.cuda.amp.custom_fwd(cast_inputs=torch.float32)
Skipping loading of custom nodes
Starting server
To see the GUI go to: http://127.0.0.1:8086

Browser Logs

-

What browsers do you use to access the UI ?

Google Chrome

Other

No response

martin-rizzo commented 2 months ago

I did some more tests:

huchenlei commented 2 months ago

Bug confirmed reproducable.

huchenlei commented 2 months ago

I think its following code causing the issue. https://github.com/Comfy-Org/litegraph.js/blob/8a8ebb49067129739ab8eee441a25835d945bfcf/src/litegraph.js#L2352

The code has been there for a long while, but the bug is only triggered recently after a refactor on node construction in https://github.com/Comfy-Org/litegraph.js/pull/98.

iamrohitanshu commented 2 months ago

@martin-rizzo Hey if you don't mind, could you please tell me what application's screenshot that is, that you posted? Also, how did you compare the two files, is it manual or the functionality of the application itself?

huchenlei commented 2 months ago

The fix will be available in today's nightly release 1.2.44. Follow https://github.com/Comfy-Org/ComfyUI_frontend#nightly-release to opt-in nightly release.

martin-rizzo commented 2 months ago

Hey if you don't mind, could you please tell me what application's screenshot that is, that you posted? Also, how did you compare the two files, is it manual or the functionality of the application itself?

@iamrohitanshu, the screenshot shows a 'diff' between the two JSON files, there are several commands and tools that can do this automatically. The one I used is Meld on Linux. Here’s a list of these utilities: https://en.wikipedia.org/wiki/Comparison_of_file_comparison_tools. I hope this helps.

Dam88en commented 2 months ago

Comfyui with Cloudflare on colab right? I had no issues before and out of nowhere I tried loading up comfyui and it doesn't load, but I get the link for it though

iamrohitanshu commented 2 months ago

@iamrohitanshu, the screenshot shows a 'diff' between the two JSON files, there are several commands and tools that can do this automatically. The one I used is Meld on Linux. Here’s a list of these utilities: https://en.wikipedia.org/wiki/Comparison_of_file_comparison_tools. I hope this helps.

@martin-rizzo Thanks for the detailed reply. I use a plugin in np++ on Windows but it doesn't look as good, that's why I asked. I'll try some of those in this list.