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

Grouping nodes together and other features. #183

Open
LeGrandToto opened this issue Apr 17, 2024 · 3 comments
Open

Grouping nodes together and other features. #183

LeGrandToto opened this issue Apr 17, 2024 · 3 comments

Comments

@LeGrandToto
Copy link

Hi , thank you for your work over the past many years for creating this tool. I really believe visually editing code makes a lot more sense than what we typically see in IDEs and would be interested in contributing to this project. I am interested in particular to use Ryven to help onboard persons on new projects they are not familiar with. A well setup flow with correct logging and a clear organisation should be helpful.

  • One feature I think Ryven can provide is the ability to group nodes to simply the graph, something similar to the graph view in tensorboard. Would you have any pointers to explore this feature?
  • I believe the OpenCV examples are out of date and I would be happy to look at reworking them. I see in some other tickets a auto_gen.py script was at some point made available. Again, can you help me walk the history of this project to know when was the last time those tools were working?
  • Given that Nodes are designed to just be Node with limited restrictions, Ryven should be able to let you accumulate the operations from nodes to nodes to then be computed all at once. Is there anything in Ryven that would force computation to happen in a Node?
  • One final use case I am also thinking to expand upon with this project is profiling: From having only a brief look at it, it should be fairly easy to display somewhere how long the last run of a node took, look at the code and then rerun the graph from a specific node. Would there be any issue in adding this information? I believe a simple overwrite of the right method of the Node class would at least log that information.

Thank you very much for your time reading this and looking forward to hearing back from you.

@leon-thomm
Copy link
Owner

  • One feature I think Ryven can provide is the ability to group nodes to simply the graph, something similar to the graph view in tensorboard. Would you have any pointers to explore this feature?

I would love to have something like this. At the moment the whole UI of Ryven is written in Qt, which has quite a few advantages (cross-platform, everything is written in Python, etc.), but it does require more effort to introduce new UI features than it might in your favorite JS framework.1

  • I believe the OpenCV examples are out of date and I would be happy to look at reworking them. I see in some other tickets a auto_gen.py script was at some point made available. Again, can you help me walk the history of this project to know when was the last time those tools were working?

Updating the OpenCV examples shouldn't be too hard. However, I advise against using things like this autogen script. The point of Ryven is not to provide a 1:1 visual mapping of Python functions to Ryven nodes. Nodes should operate on a higher level of abstraction.

  • Given that Nodes are designed to just be Node with limited restrictions, Ryven should be able to let you accumulate the operations from nodes to nodes to then be computed all at once. Is there anything in Ryven that would force computation to happen in a Node?

I'm not sure what you mean. A node updates whenever one of its inputs receives data.

  • One final use case I am also thinking to expand upon with this project is profiling: From having only a brief look at it, it should be fairly easy to display somewhere how long the last run of a node took, look at the code and then rerun the graph from a specific node. Would there be any issue in adding this information? I believe a simple overwrite of the right method of the Node class would at least log that information.

Yeah sounds reasonable. Collecting profiling information can theoretically be done within nodes, but since a useful profiler provides proper visualizations in the IDE, this feature could be part of Ryven itself, with a feature flag. The implementation needs to be a bit careful to not impose considerable runtime overhead compared to now when the feature is turned off.

Footnotes

  1. I'm actually not too satisfied with Qt's scalability. Theoretically, it can scale very well, but only if the code base is extremely well engineered. Qt doesn't really suggest a single correct way to do stuff. Therefore, things get messy too quickly, and I'm spending way more time restructuring than actually writing code. I've been thinking about rewrites in more modular frameworks (JS or Rust), but a UI rewrite is certainly a serious undertaking ;-)

@LeGrandToto
Copy link
Author

Thank you very much for your reply! To follow-up on some of the points:

I would love to have something like this. At the moment the whole UI of Ryven is written in Qt, which has quite a few advantages (cross-platform, everything is written in Python, etc.), but it does require more effort to introduce new UI features than it might in your favorite JS framework.

I do not have a lot of recent experience implementing UI libraries. I believe it would be worth to search for an open standard to represent interactive graphs and then worry about the tool/library in charge of rendering so that we can confidently export to that standard and then make your own renderer... Not sure if such an open standard exists though... I think we just really need something like SVG and be able to listen to changes done to it... so modern HTML + React/Vue/whatever is trending nowadays. If we want to remain in the python realm, I do not know if we could find some jupyter extension plug-in to work from....

Updating the OpenCV examples shouldn't be too hard.

It wasn't, having some issues because I virtually never used Qt but nothing was complicated so far... Will keep you informed once I have something worth merging.

I'm not sure what you mean. A node updates whenever one of its inputs receives data.

Allow me to provide a simple example: let's say you have a simple flow with a few "adding" nodes that have two inputs and return their sum. You then create a flow that does the following operations: 5 + 1 + (-1). With the current implementation of Ryven, we will evaluate the addition left to write and compute 5 + 1 = 6; 6 + (-1) = 5. I'd like the nodes to realise a simplifcation could be made and run the simplified version automatically. This example can be implemented by creating new Nodes that uses sympy... Add a Node that calls sympy.simplify and then add nodes that set values for the simplified expression. I would like instead to be provided with a protocol to help merge chain of nodes into a single faster node.

An other use case for a simplify or compile function is to allow a sequence of nodes to be compiled and then send to a mulitprocessing.Pool.map() to run on a lot of data in parallel... Or potentially to port the code to GPU...
This is obviously beyond the scope of what Ryven should provide but I am curious to see hear where you would be interesting to

Yeah sounds reasonable. Collecting profiling information can theoretically be done within nodes, but since a useful profiler provides proper visualizations in the IDE, this feature could be part of Ryven itself, with a feature flag. The implementation needs to be a bit careful to not impose considerable runtime overhead compared to now when the feature is turned off.

I was not thinking of publishing the profiling information (although we could) but to natively add in the UI a new element for each node where we show the time spent in each nodes and have it be part of the theme the user selected and maybe offer a dedicated tab to quickly see all the information in one place.

@leon-thomm
Copy link
Owner

Not sure if such an open standard exists though...

I don't think so, but the project file format that Ryven uses is quite generic. You could totally build another editor reading the same project files.

It wasn't, having some issues because I virtually never used Qt but nothing was complicated so far... Will keep you informed once I have something worth merging.

👍

Allow me to provide a simple example: let's say you have a simple flow with a few "adding" nodes that have two inputs and return their sum. You then create a flow that does the following operations: 5 + 1 + (-1). With the current implementation of Ryven, we will evaluate the addition left to write and compute 5 + 1 = 6; 6 + (-1) = 5. I'd like the nodes to realise a simplifcation could be made and run the simplified version automatically. This example can be implemented by creating new Nodes that uses sympy... Add a Node that calls sympy.simplify and then add nodes that set values for the simplified expression. I would like instead to be provided with a protocol to help merge chain of nodes into a single faster node.

ah, interesting. Ryven doesn't really provide an API to replace nodes or something like that (theoretically you could but it would probably break everything), and I think these kinds of modifications are beyond its scope. That being said, there are many ways you could implement this with just a little bit more manual effort (e.g. make a right-click option for your nodes that explores the graph and suggests an optimization which you can then realize by manually placing a generic sympy node and pasting some formula, or something).

I was not thinking of publishing the profiling information (although we could) but to natively add in the UI a new element for each node where we show the time spent in each nodes and have it be part of the theme the user selected and maybe offer a dedicated tab to quickly see all the information in one place.

In the development version of Ryven, on the dev branch, there are a bunch of different views for each flow now organized on the right-hand side of the editor (inspector widget, variables, undo history, node settings, logs, ...) where such a profile view would perfectly fit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants