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

Folding graph representation with Textual #938

Open
dgerlanc opened this issue Apr 28, 2022 · 4 comments
Open

Folding graph representation with Textual #938

dgerlanc opened this issue Apr 28, 2022 · 4 comments
Labels
enhancement New feature or request graph objects help wanted Extra attention is needed tooling Relates to developer tools for printing, debugging, and/or manipulating Aesara objects

Comments

@dgerlanc
Copy link
Contributor

dgerlanc commented Apr 28, 2022

We may want to investigate using Textual or rich to pretty-print aesara graphs. This would make the aesara.dprint output interactive.

With textual, an option may be to have the graphs fold and/or offer filtering capability for different node types.

@dgerlanc dgerlanc added enhancement New feature or request help wanted Extra attention is needed graph objects labels Apr 28, 2022
@brandonwillard
Copy link
Member

brandonwillard commented Apr 29, 2022

To illustrate, we're talking about making the following kinds of output interactive:

import aesara
import aesara.tensor as at

x = at.vector("x")
y = at.matrix("y")

z = x + y

aesara.dprint(z, depth=2)
# Elemwise{add,no_inplace} [id A] ''
#  |InplaceDimShuffle{x,0} [id B] ''
#  |y [id C]

For example, if a user selected/clicked the B node in this graph print-out, they would get the following expanded node:

aesara.dprint(z)
# Elemwise{add,no_inplace} [id A] ''
#  |InplaceDimShuffle{x,0} [id B] ''
#  | |x [id C]
#  |y [id D]

@brandonwillard brandonwillard added the tooling Relates to developer tools for printing, debugging, and/or manipulating Aesara objects label Jun 23, 2022
@rlouf
Copy link
Member

rlouf commented Oct 14, 2022

I looked into it, and we want to wait at least until the css branch is merged on their side: https://github.com/Textualize/textual as many things are about to change.

@brandonwillard
Copy link
Member

brandonwillard commented Dec 22, 2022

I played around with this a little:
aesara-graph-tui-extended

The features demonstrated there involve:

  • Non-breaking, mid-session usage. In other words, it can be used as a debugging tool without ruining the debug session.
  • Basic graph display and folding.
  • Identical sub-graphs are only displayed once and closest to the "root" of the graph/tree.
    Unfolding non-root copies will jump to the their roots.
  • Node search and selection. Selecting from the search results jumps to the corresponding node in the graph.

A few features that seem easy to add:

  • Narrow by sub-graph, and the ability to re-expand/undo the narrowing
  • Traversable jump history
  • Interactive graph comparisons/diffs

It would be great to get this working with Emacs' comint mode, so that the graph explorer could be used within interactive debugging sessions. This is really the only thing preventing me from considering it as a real day-to-day debug tool.

@rlouf
Copy link
Member

rlouf commented Jan 15, 2023

It would be nice to be able to jump to the next occurence the current subgraph using a shortcut like n. Other than that I think it's great and is already worth being added to Aesara!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request graph objects help wanted Extra attention is needed tooling Relates to developer tools for printing, debugging, and/or manipulating Aesara objects
Projects
None yet
Development

No branches or pull requests

3 participants