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

[visualization] update make_trace_dot #1389

Merged
merged 6 commits into from
Nov 13, 2024

Conversation

kshitij12345
Copy link
Collaborator

@kshitij12345 kshitij12345 commented Nov 1, 2024

Builds on great feature introduced by @riccardofelluga

Changes

  • We add a seperate node for input/output to a Symbol (with option to add more metadata)
  • Symbol node prints the python repr to show more information (currently we print the symbol name)
  • Update color scheme - Roots nodes are colored "green", intermediates are colored "lightblue" and leaves are colored "orange"
import thunder
from thunder.examine import make_trace_dot
import torch

def foo(x, y):
    return x + y / (x * y)

jfoo = thunder.jit(foo)

jfoo(torch.randn(3, requires_grad=True), torch.randn(3,))

t = thunder.last_traces(jfoo)[-3]
dot = make_trace_dot(t)
dot.render(format='png')

Output

Forward Graph
image

Backward Graph
image

Copy link
Collaborator

@riccardofelluga riccardofelluga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor things but overall it's a great addition!

thunder/examine/__init__.py Outdated Show resolved Hide resolved
thunder/examine/__init__.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@riccardofelluga riccardofelluga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good idea to leave the rendering to the user at they will have the dot object anyway. Stamping! 🎉

@kshitij12345 kshitij12345 marked this pull request as ready for review November 12, 2024 13:56
Copy link
Collaborator

@t-vi t-vi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you @kshitij12345 @riccardofelluga

@t-vi t-vi merged commit 3445270 into Lightning-AI:main Nov 13, 2024
44 checks passed
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

Successfully merging this pull request may close these issues.

4 participants