Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update iteration_node.py to fix #14098: Token count increases exponen… #14100

Merged
merged 1 commit into from
Feb 21, 2025

Conversation

radiumce
Copy link
Contributor

graph_engine_copy.graph_runtime_state.total_tokens should reset to zero to make the token count correct when using parallel nodes.

Summary

Fixes #14098

…s exponentially when using parallel nodes

graph_engine_copy.graph_runtime_state.total_tokens should reset to zero to make the token count correct when using parallel nodes.
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. 🐞 bug Something isn't working labels Feb 20, 2025
@Nov1c444
Copy link
Collaborator

Could you please provide more details? I am unable to reproduce the exponential token growth issue on my end.

@radiumce
Copy link
Contributor Author

radiumce commented Feb 20, 2025

未命名 This screenshot shows a translation task on my local machine. "创建术语表" is an iterative node, and I set the parallelism of the iterative node to 3. After the iterative node runs, the displayed statistics are 640.180M, while the actual number of tokens for this task is about 100k. The reason is as I stated in the issue, and as the number of parallel iterations increases, this value may even exceed the bigint range of PostgreSQL, causing the workflow to fail.

@Nov1c444
Copy link
Collaborator

未命名 This screenshot shows a translation task on my local machine. "创建术语表" is an iterative node, and I set the parallelism of the iterative node to 3. After the iterative node runs, the displayed statistics are 640.180M, while the actual number of tokens for this task is about 100k. The reason is as I stated in the issue, and as the number of parallel iterations increases, this value may even exceed the bigint range of PostgreSQL, causing the workflow to fail.

Oh, I can reproduce the issue through your screenshot. Thank you very much for your contribution.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 21, 2025
@Nov1c444 Nov1c444 merged commit a97d73a into langgenius:main Feb 21, 2025
6 checks passed
chinnsenn pushed a commit to chinnsenn/dify that referenced this pull request Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Token count increases exponentially when using parallel nodes
2 participants